jastrachan | 18 Jan 11:24 2005
Picon

Re: Performers


On 18 Jan 2005, at 07:04, Xavier Méhaut wrote:

>  Hello,
>  I would suggest the creation in groovy x.y.z of the notion of 
> "performers", which was populated few years ago by Didier 
> Simoneau(TNI). It is a kind of behaviour delegation witha a specific 
> expression...
>  Imagine you want to delegate an action on an external object like :
>
> myButton.isValidated(myPerformer);
>
>  myButton will evaluate the performer when refreshed to know if the 
> button is validated or not...
>  We can declare the performer in the following manner :
>
> Performer myPerformer = myObject << myMethod ;
>
>  we could better have :
>
> myButton.isValidated(myObject<<isValidated);
>
>  We could do that with closure, interfaces and so on, but I find it is 
> an elegant way to do this too ;)

How would this differ from the closure based version...

myPerformer = { myObject.myMethod() }

then to invoke it

myButton.isValidated(myPerformer)

or

myButton.isValidated { myObject.myMethod() }

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


Gmane