I'm leaning towards +1 for the simpler cases, but referencing earlier (labeled) 
return expression values via `label._` syntax... doesn't feel like Groovy 
anymore, IMHO.  OTOH, just because I wouldn't use it doesn't mean it's a bad 
idea.

So, if I've understood the proposal, I'd limit it to:

 * extend return statement to include form `return <expr1> if (<expr2>)`
 * the parentheses around <expr2> are optional
 * the <expr1> is evaluated first
 * the <expr2> can reference the value of <expr1> via an implicit variable
 * include short form `return? <expr1>`

Earlier emails talked about supporting full closure syntax for <expr2>.  Is 
this still included?  If so, the implicit variable would naturally be the 
closure parameter (`it` usually).  Would it make sense to use the `it` name 
even in "plain expression" form, instead of `_` or `$`?  To me, `_` denotes an 
ignored parameter, and `$` looks like something internal added by some AST 
transform.

Is the short form short for avoiding null return value, or short for Groovy 
truthiness check?  All the use cases shown are for the former, but it feels 
like the latter (b/c it is short for an if clause).

-mikko

Reply via email to