Method References

Neal Gafter neal at gafter.com
Fri Feb 26 08:55:01 PST 2010


On Fri, Feb 26, 2010 at 8:40 AM, Joshua Bloch <jjb at google.com> wrote:

> I agree that method references would be a fine addition to the proposal,
> and
> I like the proposed syntax. I believe it's important that method references
> work for constructors and static methods as well as instance methods.
>
> I am very much in favor of allowing the user to omit the type information
> when it's unambiguous.  In fact, is their any reason to use "this" (as
> proposed by Fredrick):
>
>    cb = this#saveState;
>
> or could we allow:
>
>    cb = #saveState;
>
> Not only is this more succinct, but it mirrors the rules for method
> invocation, allowing "reasoning by analogy" and reducing programmer
> astonishment.
>

I worry that it looks too much like a lambda or function type, but if we use
my proposed syntax for lambda then there is no conflict.

"Unambiguous" can't possibly refer to that term in the overload-resolution
sense.


More information about the lambda-dev mailing list