transparent lambda

Mark Mahieu markmahieu at googlemail.com
Tue Dec 29 13:02:44 PST 2009


On 29 Dec 2009, at 20:02, Neal Gafter wrote:
>> I think the labelled yield syntax could be improved.  I suspect something like "yield label : expression;" would be easier on the eyes.
> 
> Yes that looks ok.  There might be a slight readability issue when the expression contains a conditional ?: operator, but that's probably no big deal.
> 
> Presumably you'd also want to support using this in lambdas with a void result type, which might then be as simple as:
> 
> 	yield label;
> 
> With a new 'yield' keyword, I think that gives us a nice (syntactic) relationship with the use of labels and break/continue.  It's notable that it would not work out so well with 'return'.
> 
> Not so well in the sense that the colon would be required: "return label:;".

Indeed.  Potentially quite a subtle visual difference between "return foo:;" and "return foo;", I'd say.


>   On the other hand, labeled returns could be used with the method name as a label too.

Maybe... labels don't currently shadow method names though, so what would be the meaning of "return foo:;" inside a lambda labeled "foo" inside a method called "foo"?


Mark

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


More information about the closures-dev mailing list