Re:Lisp in Your Language
by kazinator on Wednesday September 09, 2015 @06:35PM
(#10195110)
Actually, all operators can be macros. Why? Because macros can use some, ahem, special API to generate machine code objects directly. Thus anything that looks like it ought to be a special form can be registered as an actual macro, called by the macro-expander. Instead of producing a tree structure, it produces some code object. The compilation pass knows what to do with that object and so it goes. (We can think of that object as a special form, effectively, but it isn't really a form at all.)
(Also note that Lisp macros don't have to be all written in Lisp. They are just expander functions. When you're bootstrapping a Lisp, you can write macros in the bootstrapping language. So the chicken-and-egg problem of "how do you write the first macros if there are no special forms" doesn't exist. You write the raw functions in assembly, or C or whatever, and register them as macro-expanders.)
(Also note that Lisp macros don't have to be all written in Lisp. They are just expander functions. When you're bootstrapping a Lisp, you can write macros in the bootstrapping language. So the chicken-and-egg problem of "how do you write the first macros if there are no special forms" doesn't exist. You write the raw functions in assembly, or C or whatever, and register them as macro-expanders.)