19.4 Designing Internal DSLs
Dynamic languages are well suited to designing and implementing internal DSLs. They have good metaprogramming capabilities and flexible syntax, and we can easily load and execute code fragments.
Not all dynamic languages are created equal, however.
I find it very easy to create DSLs in Ruby, for example.
It is dynamically typed, parentheses are optional, the colon symbol (:) can be used
instead of double quoting strings, and so on. Ruby’s elegance heavily favors creating internal DSLs.
Creating internal DSLs in Python can be a bit of a challenge. The significant whitespace can be a hindrance.
Groovy’s dynamic typing and metaprogramming capabilities help a great deal in creating internal DSLs. However, it’s ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access