Closures for Java (0.6) specification part b
markmahieu at googlemail.com
Tue Dec 15 17:30:06 PST 2009
On 15 Dec 2009, at 22:30, Neal Gafter wrote:
> On Tue, Dec 15, 2009 at 2:09 PM, Jonathan Gibbons <Jonathan.Gibbons at sun.com> wrote:
> I guess I'm still trying to find some suggestions for explicit syntax to use, that is somewhat more obvious than round vs curly parens. Maybe some variant of "#" can be used, so that simple # means simple/standard lambda, and ## or #word or word# (for some word tbd) could mean a transparent lambda.
> That was the restricted versus unrestricted function type distinction in BGGA.
> Perhaps you'd like both of the lambda forms in 0.6a to have returns treated locally, and add a third form that provides transparency?
Bit of a long shot this, but is there any value in revisiting the old idea of using a different syntax for yielding a value from a lambda? I realise that's not without its own problems, but I wonder if it would permit an alternative option: keep expression and statement lambdas as the two forms, with expression lambdas remaining as defined in v0.6a. Then allow statement lambdas to contain 'return/break/continue' (nonlocal) *and* 'yield' (local) statements, and use statement lambdas with control abstraction APIs.
It also implies that 'return' would retain the same meaning everywhere as it has now; it returns from the nearest enclosing method or constructor.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the closures-dev