i am currently testing somethings from the groovy documentation. I have stumbled across this example for a dsl.
show = { println it }
square_root = { Math.sqrt(it) }
def please(action) {
[the: { what ->
[of: { n -> action(what(n)) }]
}]
}
// equivalent to: please(show).the(square_root).of(100)
please show the square_root of 100
Is there a way to ensure the type at the "of" operation is for example an int with proper syntax highlighting?
If that's not possible, what are ways to build a sentence like dsl with proper type checking?
Thank you!
ztwjsk
