return-from-lambda viewed as dangerous, good alternatives
Lawrence Kesteloot
lk at teamten.com
Fri Jan 8 09:51:33 PST 2010
> If we continue to misinform people and tell them that lambdas are
> methods in the context of this language feature, then it is true that
> the language should reflect that correspondence. However, I believe
> it will be natural for programmers to become familiar with a language
> feature that is not grown out of this misinformation.
Neal, your blog entry "A Definition of Closures" defines a closure thus:
A closure is a function that ...
I think you will find it hard to convince programmers that "return"
should return from methods and not from functions. After all, what's a
static method if not just a plain function? These are closely tied and
you can't start playing word games and claim that functions aren't
methods so the basic rules of Java don't apply.
Perhaps we should invert your spec and have a "block" be a
fully-transparent first-class object, and a "closure" be a thin
wrapper around a block for the purposes of catching "return". The
control invocation syntax would only accept blocks.
Lawrence
More information about the lambda-dev
mailing list