return-from-lambda viewed as dangerous, good alternatives

Jonathan Gibbons Jonathan.Gibbons at Sun.COM
Thu Jan 7 15:06:59 PST 2010


Neal Gafter wrote:
> On Thu, Jan 7, 2010 at 1:58 PM, Jonathan Gibbons 
> <Jonathan.Gibbons at sun.com <mailto:Jonathan.Gibbons at sun.com>> wrote:
>
>     Doesn't this just go to show how control abstraction != closures,
>     although they could be desugared into closures?
>
>
> Sure, in the sense that control abstraction is an application of 
> closures.  But it is an important application.  Are you aware of 
> another abstraction mechanism that could play that role?

I don't deny the importance of control abstraction, and I don't deny 
that closures can provide the implementation mechanism; I was simply 
noting that we don't need identical syntax for them, or even (for users) 
to think of them as the same concept.    So, in a closure, return means 
return from the enclosing closure; in a control abstraction, return 
means return from the enclosing method, and it is merely an 
implementation detail for compiler engineers that control abstraction 
might get desugared into a closure, with any return statements being 
converted into an appropriate non-local return.

-- Jon


More information about the lambda-dev mailing list