Preparing for the 0.2 draft
Alex Blewitt
alex.blewitt at gmail.com
Fri Jan 29 14:33:27 PST 2010
On 29 Jan 2010, at 22:25, Rémi Forax <forax at univ-mlv.fr> wrote:
> public class AuthGroup {
> private final List<User> userList;
> private final int priority;
> ...
> public List<User> getAuthorizedUsers() {
> //filter works like filter in Python
> return userList.filter(#(User user) (user.getPriority() >=
> this.priority));
> }
> }
Note that you could equally write:
return userList.filter(#(User user) (user.getPrioriry() >=
AuthGroup.this.priority));
It's not that the lambda should be prevented from accessing a
surrounding instances fields; rather, the desire is to find out
examples where "this" might refer to varsity associated with the
lambda itself, such as if it extends a SAM class instead of an
interface.
In the interim, allowing explicit uses of qualified this whilst
leaving the unqualified this as a syntax error allows the point to be
debated further without blocking the goal you described above.
Alex
More information about the lambda-dev
mailing list