Something simpler?
Osvaldo Doederlein
opinali at gmail.com
Wed Mar 17 05:09:48 PDT 2010
The (ab) use of [] for function types seems indeed ouf of place in Java,
although it's hard to judge if we would just get used to it over time. When
I see this code I tend to remember both Objective-C (uses [] for message
expressions) and C# (uses [] for annotations). This can be considered either
good (there's plenty precedent fo C-family languages that make heavy use of
[] for arrays, but overload it for completely different tasks) and bad
(we're throwing even more confusion to the mix, especially for polyglot
programmers).
Having said that, cross-language comparisons are interesting but we should
focus on Java, and as a secondary priority, on its "children languages".
Java 7 will have new syntax for literal collections, so it's a top concern
to have lambda/function type syntax that goes well with that - Josh's
proposal overloads both [] and {}, so they would interact with most lambda
syntax proposals. It would be nice to see some examples of
lambdas+collections in proposals for alternative lambda syntax.
And if possible, it's certainly nice to keep some alignment with Scala,
Groovy, and/or JavaFX Script. BTW, even being a JavaFX enthusiast myself, I
must give kudos to Sun for not making any attempt, in Coin or Lambdas, to
just copy existing syntax from JavaFX Script, so far a Sun-proprietary and
non-JCP language. But all else being equal - whenever the debate boils down
to aesthetics and not hard objective issues like ambiguities - stealing some
syntax from other important JVM languages that have the same feature would
be a GREAT service to developers. We don't really need to learn three or
four completely different syntax for *basic* features like
lambdas/functions. We don't want to have complex, expensive cross-language
calls for any method that passes a lambda parameter.
A+
Osvaldo
2010/3/17 Joshua Bloch <jjb at google.com>
> Peter,
>
>
> On Wed, Mar 17, 2010 at 12:20 AM, Peter Levart <peter.levart at marand.si
> >wrote:
>
> > On 03/17/10, Joshua Bloch wrote:
> > > I don't want to be the party pooper here, but this doesn't look at all
> > like
> > > Java. I'm afraid it violates the cardinal rule of language
> > > extension: primum nil nocere.
> > >
> > > Josh
> > >
> >
> > Which part of the proposed syntax do you feel does most harm?
> >
>
> Again, not to be a party pooper, but all of it. This does not look like
> Java:
>
> [:int] two = (:2);
> assert two[] == 2;
>
>
> Java programmers wouldn't understand it, and they wouldn't be comfortable
> with it once it was explained to them. I'm sorry to be so negative, but I
> really don't think this is a good direction.
>
> Josh
>
>
More information about the lambda-dev
mailing list