Why use metaprogramming here?
Similar to Chapter 9, we will use metaprogramming here to wrap an already existing implementation of our router and router pipeline around a digestible and idiomatic interface.
Metaprogramming is especially useful in the case of the router modules because, currently, the router module is the least readable and most boilerplate-heavy of all components in Goldcrest. We also want our router to work well with all the controllers and views, so it puts an added burden on developers to make sure all the components are hooked up correctly. Therefore, by taking away the responsibility of managing that boilerplate code, we will significantly improve the developer experience of building a router using Goldcrest.
Now that we understand why the Goldcrest router is a good candidate for metaprogramming, let’s start by defining the requirements for the router DSL.