return-from-lambda viewed as dangerous, good alternatives

Neal Gafter neal at
Wed Jan 13 10:56:32 PST 2010

On Wed, Jan 13, 2010 at 12:42 AM,  <David.Moss at> wrote:
> Are there any important uses for non local returns other than
> control abstraction?

The short answer is: it depends on what you mean by control
abstraction.  If you mean "making APIs that act as statement forms",
then the answer is yes.  For example, see
 This problem/solution doesn't depend on using the control invocation
syntax, and isn't about producing an API, though using the control
invocation form may make the code look nicer.  Similar problems (e.g.
when there are two closures to receive different results) can't be
solved using the control invocation syntax but can be solved using
transparent closures.

The longer answer is that your question is conflating (the value of)
transparency with the individual elements required to achieve it in
Java.  The use-case-driven approach is a bad way to design languages.
See <>.
 Much more has been written about the value of transparency in
closures by others, including Guy Steele's famous series of papers
"Lambda the Ultimate ...".

Hm.  Somehow the longer answer ended up shorter than the short answer.

More information about the closures-dev mailing list