Category DSL

Here's another example. This one using Categories... not quite the happy happy joy joy of other ways of doing DSLs, but it does work. class MyUtility { static Integer getDays(Integer self) { self } static Calendar getAgo(Integer self) { def cal = Calendar.instance cal.add(Calendar.DAY_OF_MONTH, -self) cal } static Date at(Calendar self, Double time) { def …

DND DSL

This comes from the Venkat DSL screencast. Not that you can't type yourself, but it shows a different way to do a DSL than most people think about thePlayers = [:] def players(String[] args) { args.each {player -> thePlayers[player] = 0 } } def getPrint_dice() { thePlayers.each {player, dice -> println "${player} rolled ${dice}" } …