PROPOSAL: Method and Field Literals
Rémi Forax
forax at univ-mlv.fr
Thu Mar 12 13:55:30 PDT 2009
Neal Gafter a écrit :
> On Wed, Mar 11, 2009 at 4:37 PM, Stephen Colebourne
> <scolebourne at joda.org> wrote:
>
>>>> In summary, the real question with the proposal is whether we can
>>>> implement member literals independently of method references and
>>>> closures? The answer is definitely yes if we use the ## syntax, and
>>>> probably yes if we use #.
>>>>
>>> Is there something I should mention in the proposal?
>>>
>> I think the proposal needs to note that a resolution of the potential
>> conflict with method reference/eta expansion is required. This could to
>> let later changes handle it, to accept method references are boxed, or
>> to use a different syntax. Perhaps there is another option too. (I know
>> Neal has some concerns on this conflict of syntax)
>>
>
> I may regret saying this later, but I am not concerned about the
> potential conflict. I believe we can use the exact same syntax and
> distinguish whether it should be a java.lang.reflect.Method or a
> closure from context. Since we're doing Method first, it would take
> priority (just like a method invocation that requires no boxing is
> preferred during overload resolution to one that requires some
> argument to be boxed).
>
>
Neal,
I don't know if you will regret saying this but
I will regret to not saying that it will create lot of puzzlers like
this one:
class A {
static int f(int) { ... }
}
...
{int => int} c=A#f(int);
A#f(int).equals(c) // false because A#f(int) is a
java.lang.reflect.Method
Rémi
More information about the coin-dev
mailing list