RE: Re: [Beanshell-users] Groovy?
"Shankar Unni" <[email protected]>
| Newsgroups | gmane.comp.java.beanshell.devel,gmane.comp.java.beanshell.user |
|---|---|
| Message-ID | <[email protected]> |
Ian Clarke wrote:
> I'm not sure exactly what the argument is against Java
> incorporating syntactic support for maps and such-like,
> except perhaps that a language's syntax should be kept as
> simple as possible. The introduction of foreach support and
> other things in 1.5 would seem to suggest a relaxation of
> this attitude.
This is an excellent point.
In fact, scripting languages are a great platform for proof-of-concept for
any new language syntax features.
For instance, the Groovy builtin List/Map syntaxes are extremely useful not
only for scripting, but as general Java language features. The way that
Enums and Foreach have been implemented in JDK 1.5 (using new standard
library types java.util.Enum and java.lang.Iterable) shows that Groovy's
approach of layering syntactic sugar on top of standard library types is
perfectly legitimate.
(There is actually a JCP for a feature very much like the native list syntax
in Groovy - JSR65, or "Concise Object-Array Literals", for which the syntax
is somewhat different. It uses {a,b,..} instead of [a,b,...], but the Groovy
folks have admitted that the reason they went with the latter was to allow
for Closure syntax, which is probably less important for Java or BeanShell.
Perhaps it would be best if the syntax implemented were closer to JSR65, so
use {} instead of []).
Once we have these features in broad use in scripting languages, there'll be
a popular groundswell of support for extending the Java language proper with
them, too. The main thing is to see if we can reach the critical threshold
of usefulness and simplicity, which seems to have been the primary
motivation for foreach and enums making it into the language.
--
Shankar
-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn