Re:A DSL in 5 Languages: Ruby, Python, PHP, C#, Java
by pgr0ss on Tuesday August 03, 2010 @01:31PM
(#1571944)
Your syntax is definitely simpler. One reason we did it the way we did was to get compiler checking for operators. We've tried to follow idioms in different client libraries, and for the statically compiled languages, we've tried to make it so if it compiles, it will work.
Since the field comes first (orderId().startsWith()), if you try to call an operator on a field that does not support it, it will not compile.
Re:A DSL in 5 Languages: Ruby, Python, PHP, C#, Java
by supersillyus on Tuesday August 03, 2010 @01:51PM
(#1572012)
You should make it clearer in the commentary that you're holding the static languages to a higher standard.
With the existing method, you can still ditch the empty parens by using public final fields. You just have to pre-populate them all with respective grammar objects.