Method references with types [Re: lambda syntax tutorial]

Stephen Colebourne scolebourne at joda.org
Sun Aug 8 02:46:28 PDT 2010


On 8 August 2010 10:27, Fredrik Ohrstrom <oehrstroem at gmail.com> wrote:
> JSR292 will never offer field literals.
Technical or philosophical restriction?

> If you want field setters and getters it is trivial to write:
> Function(Person)->int getage = { p -> p.age };
ie. developers should write boilerplate code...


There are two arguments here
1) Consistency. Java has fields and methods. Why are methods getting
preference? If I know nothing about the language, then its an
additional rule to learn.

2) Properties. I still hope that at some point real properties will be
added to Java. I've stated before my view that properties should have
been added before generics and closures - they are that critical, and
that wasteful. Using up the syntax here may well make property
references nigh on impossible.

(3) see Davis' mail!

Stephen


More information about the lambda-dev mailing list