jastrachan | 2 Mar 08:35 2005
Picon

Re: Groovy beta 10 released! (+JSR Early Access)


On 1 Mar 2005, at 22:09, Martin C. Martin wrote:

> jastrachan@... wrote:
>> The reasoning behind this is that without this rules we cannot use 
>> the  concise syntax for passing closures around. e.g. adding a 
>> newline  before { changes this meaning
>> // method call with closure parameter
>> coll.each { println "hey" }
>> // property access of 'each' then a regular block
>> coll.each
>> {
>> println "hey"
>> }
>
> To quiet the whiners, couldn't we simply allow it for existing java 
> constructs:
>
> while(expr)
> {
>   blah
> }

We do allow this :)

> And for new constructs when using parens?
>
> coll.each (
> {
>    blah
> })

And this :)

So folks can use both options today.

The only issue is should we try warn users of invalid bracket placement 
when performing closure passing statements (e.g. when not using parens 
in the last example)

James
-------
http://radio.weblogs.com/0112098/


Gmane