|
|
|
|
|
by cess11
396 days ago
|
|
An API is an interface, metaprogramming is a technique for building such interfaces by treating code as data. They aren't interchangeable concepts. Metaprogramming comes in handy when ordinary programming results in a lot of complex, hence unmaintainable, code or can't achieve something due to how the language is implemented. It can vastly simplify how you express application logic, e.g. when interfacing with foreign programming languages such as SQL or generating code from data. Any sane metaprogramming regime allows you to do something like macro expansion, i.e. look at the code the metaprogramming is compiled into in the current context. |
|