
DSLs in Groovy - hliyan
http://groovy-lang.org/dsls.html
======
zmmmmm
I love Groovy as a language but I have always been a bit divided on the DSL
usage.

All the DSLs look cool on the surface, but they are all based on syntactic
tricks that have subtle and unintuitive failure modes. When you mistype
something in one of these DSLs, the error that comes out of the Groovy parser
will make almost no sense to a naive user, and it is not easy to fix that and
make it friendlier. It can lead to a really hostile user experience which
doesn't end well. I think this is one of the reasons there is quite an
antipathy towards Gradle amongst many people, because it is essentially a
Groovy DSL and even among programmers this experience where there is no real
intuition or understanding of how the language is getting interpreted is very
frustrating.

------
eindiran
The feature discussed in the section entitled "Operator Overloading" is
analogous to uniform function call syntax in Nim and D. It was something that
at first I thought added unnecessary complexity to reading the code, but I
slowly came around to it. Now I actually think that (once you know that it can
be done) it makes code easier to read, in that you can choose to use the
method-like syntax or the standard syntax depending on the particular
situation.

I've written a fair amount of Groovy, but it's mostly been simple stuff
integrating with Gradle or Jenkins. Maybe I should give it a try on a more
significant project. There are a few features that make it quite interesting
and some ideas that I think other languages could learn from (the one that
leapt to mind is the Elvis operator for a special case of null-coalescing).

