Something simpler?
Joshua Bloch
jjb at google.com
Thu Mar 18 15:28:31 PDT 2010
Reinier,
On Wed, Mar 17, 2010 at 9:13 PM, Reinier Zwitserloot <
reinier at zwitserloot.com> wrote:
> I just don't understand how this works. Some syntax doesn't feel right to
> someone, and the magic words "This isn't java" are spoken. Is there some
> sort of device to measure this property? I'd love to get my hands on a
> javometer.
I don't have a Javometer, but my assertion isn't arbitrary, and it isn't
purely aesthetic (though it does have an aesthetic component). Looking at
the proposed syntax, I can tell you why it doesn't look like Java:
[:int] two = (:2);
assert two[] == 2;
Java declares return types *before* variables and doesn't use the colon to
indicate the return type. Other languages (such as Pascal and Scala) put the
types after the variable name, separated by a colon. So this is a specific
point where the proposed syntax deviates from established Java norms.
Also, brackets strongly suggest arrays to existing Java programmers,
especially when preceded by an identifier. This is even more true if the
brackets contain an integer-valued expression:
assert x[i] == 42;
If x[i] could be a lambda invocation as well as an array reference in the
above statement, we've done real harm to the language.
Josh
More information about the lambda-dev
mailing list