jastrachan | 21 Apr 12:15 2004

Re: Parens and Parameters

On 21 Apr 2004, at 05:46, clint@... wrote:

> I see my error now.  I didn't understand the reasoning for the 
> inconsistent
> rule about optional parens until I read Chris' note about 
> writer.println being
> a method pointer.  This reminded me that the following code is legal 
> in groovy:
> p = writer.println
> p()
> Very nice, but this feature forces the use of the "optional" parens on 
> calls
> like writer.println().  I really don't like optional syntax, 
> especially when
> it's not optional.  :-)

You could argue the above isn't using optional syntax.

// property access syntax

// method calling syntax

So the above would still work even if () were mandatory in all cases.

i.e. right now today, using property access notation will try lookup a 
bean property, if there's no property of that name it returns a method 
closure for that method (if there is a method of that name).