jastrachan | 1 Mar 19:47 2005

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

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
println "hey"

so we insist on passing closures using the { on the same line as the  
method call.

We can allow whitespace after if/for/while and the like; though  
currently we warn that this indentation mechanism could cause  
confusion/trouble when using closures as method parameters with the  
above syntax.

On 1 Mar 2005, at 18:30, M. Sean Gilligan wrote:
>> I generally like the language cleanup that is going on with the JSR  
>> version,
>> but there is one thing that seems quite wrong to me:
>> "all blocks should commence on the same line. A warning is generated  
>> if this
>> is not the case"
> This is very un-Java-like.  I have used the coding convention:
> while (condition)
> {
> }
> For 20 years in C, C++, Java, and now (non-JSR) Groovy.  I know that  
> this is not  the K&R style, but I, and many others, find it very  
> readable.  To make white space significant at this point seems to be a  
> major violation of the C/C++/Java tradition.  Making semicolons  
> optional is weird, but I can always put them in or even run a  
> lint-like program to enforce the coding convention, but a built-in  
> compiler warning seems extreme.
> IIRC, closures require the block to begin on the same line and this  
> was an annoyance and inconsistency, but I had hoped it was going to be  
> fixed.
> Has the JSR group already committed to "all blocks should cmmmence on  
> the same line"?  Or is there any hope this might be changed back?
> -- Sean
> --  
> ----------------------------------------------------------------------- 
> ----
> M. Sean Gilligan                    : 831-466-9788 x11
> vBlog Central			    : http://www.vblogcentral.com
> ----------------------------------------------------------------------- 
> ----