Problem with method references
maurizio.cimadamore at oracle.com
Fri Jan 14 01:55:35 PST 2011
On 14/01/11 09:41, Rémi Forax wrote:
>>> Hello Maurizio,
>>> I see that referencing instance methods from static context is a desirable feature, but syntax-wise I aggree with Neal that the same expression should not change its meaning if moved from static to instance context or vice-versa (when both contexts are legal). So I propose that the syntax:
>>> be made illegal for referencing instance methods from static context.
>> I agree - since #methodName is essentially a shortcut for
>> this#methodName, it is sensible to reject it in a static context.
>> Thanks for the example - I will make sure to add it to our regression
>> tests as soon as I add support for #this.
> It remember something, do we have a plan to support constructor call, I
> mean not
> constructor call from a constructor (this(...)) but constructor call
> that return a newly
> created object.
> Something like: new#Integer(int)
> which should be typed (int) -> Integer.
That sounds entirely reasonable. I see few problems in the following cases:
*) inner class creation, which might depend on an enclosing instance -
do we want to treat the enclosing instance as an additional parameter?
*) qualified new expressions - in this case it seems sensible to just
add the explicit enclosing class reference to the MH (i.e. through bind).
More information about the lambda-dev