4 ms·
> The perfect Java replacement would have - local type inference, less verbosity (e.g. public by default), full closures, anonymous blocks, no generics, special
by phillco 15y ago
> The perfect Java replacement would have - local type inference, less verbosity (e.g. public by default), full closures, anonymous blocks, no generics, special syntax for arrays and hashes, operator overloading and the ability of a variable to behave as if dynamic (e.g. leveraging the future InvokeDynamic). I would also completely purge checked exceptions and also get rid of the general syntax for anonymous classes - basically get rid of anything not useful.
Ahem. http://groovy.codehaus.org/ http://groovy.codehaus.org/
The #1 feature of Groovy in my mind is that there is almost no learning curve whatsoever. All Java code is already Groovy code - you can learn all the dynamic tricks as you go.
- Lewisham 15y agoAll Java is also a valid subset of Scala, IIRC.
- devinfoley 15y agoScala introduces new versions of collections like Map and List that aren't compatible with Java's versions. The syntactic sugar only works with the Scala Maps. Meanwhile, Groovy uses Java collections.
- mark242 15y agoLuckily, in Scala there's a JavaConversions package that allows you to cast back and forth from Maps, Lists, Sets, etc, to whatever Scala type you want. http://www.scala-lang.org/api/current/scala/collection/JavaConversions$.html http://www.scala-lang.org/api/current/scala/collection/JavaC...
- devinfoley 15y agoDamn, I wish I'd known about this sooner. Thanks!
- dmcg 15y agoNot true if you mean that their syntaxes are compatible, they are quite different.
- Lewisham 15y agoMaybe I was thinking of Groovy. Sorry, commenting before morning coffee :)