Nicer DSLs in Groovy 1.8 thanks to Extended Command Expressions
Posted by:
Guillaume LaForge
on
<meta charset="utf-8"><p>A quick heads-up to tell you about an upcoming Groovy 1.8 feature which will allow us to make nicer DSLs. This feature will be available in Groovy 1.8-beta-2, which will probably be released before JavaOne.</p><p>Lidia Donajczyk was our Google Summer of Code student this year, working on the implementation of GEP-3, an extension to Groovy's command expressions. You can have a look at the <a href="http://docs.codehaus.org/display/GroovyJSR/GEP+3+-+Command+Expression+based+DSL">GEP-3 page</a> for the guiding ideas behind this enhancement proposal.</p><p>Just like you could use simple command expressions before, like:</p><pre class="groovy"><code>println "hello"<br>move left<br>make coffee<br>drink tea</code></pre><p>GEP-3 extends this for more complex sentences such as:</p><pre>drink tea with sugar and milk<br>move left by 30.centimeters<br>sendFrom "Guillaume" to "Jochen"<br>send from: "Jochen" to "Lidia"<br>Email.from "Lidia" to "Guillaume" withBody "...<img src="http://feeds.feedburner.com/~r/glaforge/~4/dpUF3PkWavY" height="1" width="1"/>
Guillaume LaForge's complete blog can be found at: http://glaforge.appspot.com
About Guillaume LaForge
As Head of Groovy Development for SpringSource, Guillaume Laforge is the official Groovy Project Manager, and the spec lead of JSR-241, the Java Specification Request that standardizes the Groovy dynamic language. He is also a frequent conference speaker presenting Groovy and Grails at JavaOne, SpringOne, QCon, the Sun TechDays, and JavaPolis. Guillaume also co-authored Groovy in Action along with Dierk König. Before founding G2One, which was acquired by SpringSource in late 2008, and taking the role of VP Technology, Guillaume worked for OCTO Technology, a consultancy focusing on architecture and agile methodologies. While at OCTO, Guillaume developed new offerings around Groovy and Grails for its customers.
More About Guillaume »NFJS, the Magazine
December Issue Now AvailableBDD and REST
by Brian SlettenMocks and Stubs in Groovy Tests
by Kenneth KousenAlgorithms for Better Text Search Results
by John GriffinKnowns and Unknowns of Scrum and Agile
by Brian Tarbox