« Return to Thread: Task DSL

Re: Task DSL

by hdockter :: Rate this Message:

Reply to Author | View in Thread


On May 14, 2009, at 8:22 AM, Russel Winder wrote:

> On Thu, 2009-05-14 at 08:10 +0200, Hans Dockter wrote:
> [ . . . ]
>>> a list, etc.  Used in that context it is idiomatic.  Used simply to
>>> replace a call of a method that doesn't have inserter semantics,  
>>> it is
>>> probably a bad thing to do.
>>
>> Could you explain a bit more what you mean with the last sentence?
>
> The analogy is basically that << should never replace assignment or a
> named action other than append if it is to be being used  
> idiomatically.
> So
>
>        x = [ ]
>        x << a
>
> is fine since the semantics are inserter semantics, the value a is  
> being
> appended to x; << replaced append:
>
>        x.append ( a )
>
> If << simply replaces a non appending method call then it is being  
> used
> outside its idiomatic meaning and so will lead to misreading of
> programs.
>
> doFirst and doLast are appending methods, they append new actions to  
> the
> hook.  So << has a natural position somewhere here.  The question is
> whether it should replace doFirst or doLast.  The problem is that it
> cannot be used with both, it can only be used with one.  The doubt  
> leads
> to a cogent argument that perhaps it shouldn't be used with either.
>
> Ambiguity leads to ambivalence :-(

Thanks for the explanation. Regarding your last point and ambiguity.  
You could say the same about << operator for lists. Lists have a  
couple of methods to get stuff into them (e.g. add(Object) and  
add(index, Object)). But the << operator picks the most common one. We  
do the same.

- Hans

--
Hans Dockter
Gradle Project lead
http://www.gradle.org





---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


 « Return to Thread: Task DSL