jastrachan | 18 Jan 11:17 2005

Re: Exploder method name

Named parameter passing for invoking methods would be nice, especially 
when there's a bunch of parameters and the order is non-obvious. We 
added support for bean construction using named parameter passing 
(which really uses a zero argument constructor and then sets bean 
properties on each argument). To go the whole hog and support arbitrary 
method invocations using named parameters, we need the metadata for the 
parameter names - which isn't typically available in the Java bytecode. 
We could make it available in Groovy bytecode - but this would make 
this feature only available when calling Groovy code - which is OK but 
its cleaner if Groovy works over any Java bytecode.

Maybe this needs to go into the 2.0 bucket.

On 18 Jan 2005, at 07:13, Xavier Méhaut wrote:
>  Hello,
>  I would suggest another enhancement for a future groovy, ie the use 
> of exploded method name capability. The idea is to mimic the Smalltalk 
> way to name a method in order to render the method more natural to 
> read.
>  For instance the method :
> myObject.read(fromObject, toObject, withObject);
>  could be also written under the form :
> myObject.readFrom(myObject1)
>                   to(myObject2)
>                   with(myObject3);
>  or for former Smalltalker :
> myObject.readFrom: myObject1
>                   to: myObject2
>                   with: myObject3;
>  Imagine you combine this feature with the performers explained in 
> aprevious mail, you could have :
> Button aButton =  Button.Create: aName
>                                             isValidated: anObject << 
> isValidated
>                                             foregroundColor: anObject2 
> <<foregroundColor
>                                             backgroundColor: anObject2 
> <<backgroundColor
>                                             isVisible: 
> anObject<<isVisible;
>  regards
>  Xavier