Start by Defining the Minimum Viable API

Now that we know the kind of DSL that we would like to build, we need to decide how to design our API. The HTML spec includes some 117 valid tags, but we need a smaller surface area to begin our DSL. At this point you might be tempted to fire up your editor and start defining all 117 tags as individual macros. There’s a better way. Since we define a mini language with macros when creating DSLs, the best way to begin is to define the smallest set of macros possible to serve as a basis for the broader macro DSL. Instead of immediately planning to support the entire HTML spec as macros, let’s start with a refined set of macros that can still speak the HTML language.

The smallest API of our HTML library would ...

Get Metaprogramming Elixir now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.