transparent lambda

Mark Mahieu markmahieu at googlemail.com
Mon Dec 28 10:05:35 PST 2009


On 28 Dec 2009, at 17:18, Neal Gafter wrote:

> On Mon, Dec 28, 2009 at 9:12 AM, Mark Mahieu <markmahieu at googlemail.com> wrote:
> Making labelling a requirement to use 'yield' certainly seems too awkward, but perhaps defining a non-labelled yield as transferring control from the 'outermost' lambda (ie. transparent semantics for yield by default as well) would combine the desired preservation of semantics with 'nice' syntactic for the '9 out of 10' cases (because it's probably not even nested).
> 
> I can't tell if you're joking or not.  That would mean that apparently simple code such as this
> 
> #(){ yield 3; }
> 
> could not be understood without looking at all of the enclosing context.
> 
> Cheers,
> Neal
> 

No I'm not joking, but my wording could probably have been clearer;  I'm suggesting that the non-labelled form would *only* be valid in the 'outermost' lambda; in a nested lambda the labelled form would be required.

It's a bit of a cheat regarding Tennent's C.P, in that your example could not be refactored to equivalent code simply by wrapping the 'yield' in a (nested) lambda and invoking it - a label would have to be added to make it valid.

Mark

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.openjdk.java.net/pipermail/closures-dev/attachments/20091228/c2752175/attachment.html 


More information about the closures-dev mailing list