Saturday, October 31, 2009

The King is Dead!? Long live... Scala? Clojure?!

Whoa, why wasn't I told Java is closing its doors? I guess I have been out of touch, word seems to be everywhere. I had to go here (blog of the guy who created Groovy) to find out. James is whooping it up over Scala as Java's successor. Yes, the guy who invented Groovy prefers Scala. Quite a bit:
I can honestly say if someone had shown me the Programming in Scala book by by Martin Odersky, Lex Spoon & Bill Venners back in 2003 I'd probably have never created Groovy. -- James Strachan

Damn. So he pretty much invented Groovy by mistake? Did not know about the two-year old Scala? No one mentioned it to him? Groovy got admitted to the standard in the meantime?

Well, Johnathan Edwards reinvented Python Trellis (ergo Cells) without knowing it, and I did not know about Garnet's KR or constraints -- but Groovy got adopted as official Java! You think Scala might have come up over coffee. Anyway...

Steele said Java brought the world half-way to Lisp. I do not think Lisp means what he thinks it means. Proof might be how hard it is for folks to climb out of the pit of javathink. If Java had been a stepping stone to Lisp it would have made the next step easier, not harder. But Java still cannot do closures. Please. And a quick look at closures in Scala has me thinking, omigod, they call that closures?

Clojure starts to look like a Good Move. I see it mentioned in writings on the death throes of Java and that is a big marketing win. The superwhacky thing here is that both Scala and Clojure are syntactically discontinuous from Java. Folks always thought successors had to have syntax similar to the succeeded though Dylan should have served as cautionary counter-evidence.

No, it is not the syntax. The necessary bridging element seems to be....wait for it...the Java runtime! How did that tail end up wagging the language adoption dog? But Clojure gets the nod along with Scala just for sitting atop the JRE! You people scare me.

Well, if Steele were right Clojure would prevail over Scala. Right now googlefight has Scala winning five to one. Maybe Rich Hickey can move 17% of the world 90% of the way to Lisp?

12 comments:

Ant... said...

> But Clojure gets the nod along with
> Scala just for sitting atop the JRE!
> You people scare me.

Makes perfect sense though - Java won the marketing battle 15 years ago, and is now a big part of most companies' IT ecosystems. And as a platform the JVM is mature, stable and capable.

Having Clojure/Scala running on the JVM means that all in house libraries are available for reuse, and the guys at the top who decide which technologies to use (without of course understanding the tech in question) never need to know... It's just getting into the arena via the backdoor.

Phil said...

> Right now googlefight has Scala winning five to one.

Scala is a word that has many meanings, one of which is a programming language. Clojure is a word that was invented _because_ it was unique. I don't doubt Scala the language is more popular than Clojure, but the 5-to-1 number is very misleading.

Kenny Tilton said...

The googlefight was actually accompanied by "java", and is also what I would expect based on Clojure's oddness. A fight on just Scala vs Clojure is more than 50-to-1. Got any actual knowledge about Scala and Clojure popularity to share instead of worrying about what after all was meant to be a silly metric?

The Grey Lens Man said...

I don't see an major issue with Scala's closures, they are closures by any reasonable definition given the design constraints.

Surprise, Scala also has delimited continuations, in fact serializable ones. Google Scala + Swarm.

With tail call recursion, delimited continuations, and a call-by-name capability which allows for types of constructions one typically uses macros for, e.g.such as custom loop construction, or callWith thunk wrappers as well as Sequences, Scala is pretty Lispy.

In fact IF one were to take the position that the true ultimate lisp in terms of power and capability are the Scheme lisps (and I'm thinking MzScheme here, and not a R5RS minimalist definition) and not CL, then Scala is closer to Lisp then CL is. Trollish yes, but a kernel of truth exists in that statement nonetheless.

Again based on my Lisp criteria of TCO, delimited continuations, very lightweight hygenic dsl syntax capability.

While not a full MOP with multi-methods, Scala has mixins.

Scala also has default and named arguments.

It is actually possible to effectively avoid or minimize object use altogether in Scala and write pragmatic functional code that is _very_ similar to SML code, with equivalent constructs to sigs ans structs even functor like construction except one gets it at runtime. In addition, algebraic datatypes and pattern matching.

So Scala is pretty SMLly as well.

I'd say its feels easier to move oneself into writing HOF / lambda centric code in Scala then CL, less easier then in Scheme, and takes a bit more act of self-awareness of intent then in SML and certainly Haskell. But a high level lambda like coding style is not that difficult in Scala at all.

So certainly I'd say Scala is a better Functional Language then Scheme or CL, not too far behind the MLs.

What is amazing about Scala is Martin O. has somehow managed to synthesize all these bits and pieces into a whole that has a seamlessness to it.

Yes, it has a few rough spots, but the whole has a conceptual integrity about it.

I'd say Scala is a lot more Lisp-like, by my definition of Lisp,then is apparent at brief glance.

Kenny Tilton said...

@greylensman, the devil is in the details. You massively hand-waved on macros, reminding me of Norvig saying regex was the same as macros because you could use it to write a DSL parser. A true Lisper does not consider Scheme to have macros since Scheme macros are so damn hard to code. Scala closures look the same -- abstract capability, maybe. Same programmer experience, not.

Luke said...

Heck, Java has all those things, if you want to use byte-code weaving with Aspect Oriented programming and heavy class rewriting with annotations and use anonymous inner classes instead of closures.

Expressiveness in a language is about how easy and natural it is to "do the right thing", rather than what's possible in the abstract. All programming languages are, after all, Turning-complete.

Personally, this is the reason I much prefer highly-designed, well thought out single-paradigm languages like Clojure rather than "everything and the kitchen sink" languages like Scala.

Gabriel said...

With a static type system and no macros, I don't think Scala has any appeal to "Lispers". On the other hand, it provides a fairly advanced language in the JVM.
Out of curiosity, what's the difference between Scala and Lisp closures?

Phil said...

> Got any actual knowledge about Scala and Clojure popularity to share instead of worrying about what after all was meant to be a silly metric?

Fair enough... let's see; soon they both will have three books available, and they both have about the same number of people on their respective IRC channels.

Scala is the 18th most popular language on Github, (http://github.com/languages/Scala) while Clojure bounces between #20 and #21. (http://github.com/languages/Clojure). I'd be surprised if they weren't within 50% of each other in terms of usage levels.

Kenny Tilton said...

@phil Go, Clojure, go!

Patrick Sullivan said...

FYI Phil, there are 3 more books in the works, meaning there will be 4 clojure books soon (Prog Clojure is out now, Amit Rathore's from Manning, APress has one being worked on by Luke Van Der Hart (hope I spelled that right) and finally Idiomatic Clojure by Chris Houser and Fogus (This one and Amit's interest me the most, Idiomatic because Houser is arguably the next most knowledgeable person about Clojure behind Rich himself, so a book he's helping with should be amazing).

einjun said...

@ Grey_lens_man:
That was crazy. What are you smoking?

-----------------
Quoting: Grey_lens_man
"then Scala is closer to Lisp then CL is. Trollish yes, but a kernel of truth exists in that statement nonetheless.
-----------------

Yep, just like a kernel of truth exits in the statement that a plastic model of F16 is closer to the idea of an F16 than an F16 is. And just as useful.

-----------------
Quoting: Grey_lens_man
I'd say Scala is a lot more Lisp-like, by my definition of Lisp,then is apparent at brief glance.
-------------------

You seriously need help.

einjun said...

Maybe we don't need Clojure to prevail over Scala.
If everyone catches on to lisp and rises against being average, how can you beat the averages?