Method calls vs lambda calls
Stefan Schulz
schulz at the-loom.de
Wed Dec 16 05:03:28 PST 2009
Howard Lovatt wrote:
> If you allow function-type variables to be hidden (static case) or
> shadowed (instance case) then it can be very confusing, e.g.:
>
> class FortyOne {
> int f() { return 41; }
> #int() ft = #int() (41);
> }
> class FortyTwo extends FortyOne {
> int f() { return 42; }
> #int() ft = #int() (42);
> }
> FortyOne aFortyTWO = new FortyTwo();
> out.println( aFortyTWO.f() ); // prints 42
> out.println( aFortyTWO.ft() ); // prints 41!!!
If function-typed variables are in the method name scope, why should not
ft be overridden in the same way that f is overridden?
Stefan
More information about the lambda-dev
mailing list