On Wed, 2009-05-13 at 15:36 +0200, Hans Dockter wrote:
[ . . . ]

I have to admit to being ambivalent on the new task definition notation.
On the one hand I prefer it to what was before, on the other hand it is
not a Groovy script per se and so is difficult to read.

If this were just a DSL then clearly AST transforms are a great tool for
handling "parsing on the fly" -- it ensures a language that might
otherwise have to have been an external DSL can be an internal DSL.
However great play is made of Gradle specifications being Groovy
scripts, not scripts in a DSL.  This means a Gradle script should
clearly and obviously be a Groovy program and this means AST transforms
that change standard Groovy rules should not be used.  In this case a
task specification is not obviously Groovy.

On the third hand the issue is trivially that the symbol after the task
"keyword" is being auto stringified.  This is why I find myself totally
unable to decide.  The change from Groovy is trivial and clear, but it
is a change from Groovy and so incomprehensible.

> task hello << { <action> }
> task hello { <configure> }
> task myJar(type: Jar) { <configure> }
> existingTask << { <action>} // equivalent to existingTask.doLast
> existingTask { <configure> }
> 
> We were also thinking about using the work 'do' instead of <<. That  
> would be nice to read. But this is not trivial to implement in Groovy.  
> And the << operator is already used in Groovy for adding elements to a  
> list, which is something similar to adding an action to a task.
> 
> Feedback is very welcome

Using << is already idiomatics in Groovy so no problem there.

Perhaps the example would have been better if the edit
g/existingTask/s//hello/ or g/existingTask/s//myJar/ was applied?

-- 
Russel.
============================================================
Dr Russel Winder                 Partner

Concertant LLP          t: +44 20 7585 2200, +44 20 7193 9203
41 Buckmaster Road,     f: +44 8700 516 084    voip:  
sip:[email protected]
London SW11 1EN, UK.    m: +44 7770 465 077    xmpp: [email protected]

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to