Is there a resource that would help me understand how defmacro can be defined as a macro via defmacro?

Indeed, its the bootstrapping…

Lets take a look at the top of the file that defines the Kernel module:

As you can see it indeed starts with importing the Kernel module, except all those macros and function it uses later on.

Then it imports the :elixir_bootstrap module, which again contains the actual defintion of, eg. defmacro in erlang.

or the define function called in the Kernel.defmacro implementation:

5 Likes