Updated State of the Lambda
Mikael Grev
grev at miginfocom.com
Fri Oct 15 15:54:18 PDT 2010
I like the infix version better. It denotes more clearly that it is the method that's being referenced.
It's also more natural when the class can be taken from the context to go from Class#method to just #method.
Cheers,
Mikael
On Oct 16, 2010, at 0:30 AM, Brian Goetz wrote:
>> I don't understand why # is infix for method reference.
>> As you said you need to restrict the receiver form
>> because a simple expression like #a.b.toString() is ambiguous.
>
> I think the prefix notation (#ClassName.methodName) is more natural since the
> # is supposed to be the hint of "delayed evaluation of the next thing". But
> there would definitely be ambiguities if we allowed arbitrary expressions of
> the form #e.methodName. So our choices are to restrict the form of the
> expression, or to switch to an infix notation like ClassName#methodName, which
> is less problematic in terms of corner cases but personally I find it less
> natural. IN these simple cases everything is fine, but in cases of chained
> references #a.b.c where there are conflicts between field names and method
> names, there are clear ambiguities that would have to be worked out.
>
>> Is there a document explaining the translation proposed into bytecode ?
>
> Well, the prototype compiler can be considered a document of sorts :)
>
> THere is still the old translation document which is a little out of date.
> We'll be bringing it back into consistency with the compiler soon. But before
> that I want to finish my work on compatibility guarantees for extension methods.
More information about the lambda-dev
mailing list