So DSLs are pretty cool, huh? It’s tempting to solve all kinds of problems this way, but be careful. Many problems that seem like a good fit for a DSL are often better served by standard functions. Whenever I’m trying to decide whether a DSL is a good fit, I ask myself the following questions:
Can the domain be expressed naturally by macros in Elixir’s syntax, such as HTML tags?
Would a DSL cause the caller to think more or less about how to solve their problem?
Should I require users of my library to have all kinds of code injected into their context?
The answers to these questions vary, and many times it’s a gray area. To help illustrate these points, let’s imagine a fictitious Emailer library that we would like to build. ...