return-from-lambda viewed as dangerous, good alternatives
Neal Gafter
neal at gafter.com
Fri Jan 8 12:56:29 PST 2010
On Fri, Jan 8, 2010 at 9:51 AM, Lawrence Kesteloot <lk at teamten.com> wrote:
> 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?
It's a method. It is scoped in its containing class. It has a name
in the method namespace.
> 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.
The basic rules of Java aren't yet defined for closures. These aren't
word games: you can't reasonably claim that a construct not yet in the
language is already defined.
> 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.
I'm not sure I understand your proposal. How would one declare the
parameters of a block? How would one yield its result value? Or is
CfJ 0.6 a/b <http://www.javac.info> already what you're describing,
but with your "block" called an "expression closure"?
More information about the lambda-dev
mailing list