Just realized that looking at language extensions sent me down a rabbithole on Macros, and I might have gotten myself totally turned around. 🤷🏼♀️
bit of history
Macros can be used to make tasks less repetitive by representing a complicated sequence of keystrokes, mouse movements, commands, or other types of input. In computer programming, macros are a tool that allows a developer to re-use code.
best explianation i have found so far
Fundamentally, macros are a way of writing code that writes other code, which is known as metaprogramming. rust docs
macro is going to happen at compile time. where a function is going to happen at run time.
code that writes code. 🤔 This is less readable, understandable, and maintainable then general functions.
Declaritive w/ general metaprogramming
Prodecural more like functions
Problem babel macros sets to solve solution
Explicit is often a better pattern than implicit because it requires others to understand how things are globally configured. This is in this spirit are babel-plugin-macros designed. However, some things do need to be implicit, and those kinds of babel plugins can’t be turned into macros.