Problem with method references
maurizio.cimadamore at oracle.com
Fri Jan 14 02:45:08 PST 2011
On 14/01/11 09:58, Peter Levart wrote:
> On 01/14/11, Maurizio Cimadamore wrote:
>>> 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.
> I don't know if we should allways reject #methodName in static context. Only if it refers to instance method. If it refers to static method, it should be a shourtcut for:
> analogous to static method invocation.
Right, I was meaning that we should ban #methodName, where methodName
denotes an instance method accessible from the current context.
>> Thanks for the example - I will make sure to add it to our regression
>> tests as soon as I add support for #this.
More information about the lambda-dev