timonoko 2 days ago

Bad memories. Some malformed macro may evaluate differently than compile and the problem is impossible to find.

2
kazinator 2 days ago

This is a feature. It is something you want sometimes and don't want at other times.

Macros can stage calculations to compile time. Compile time can happen in a completely different environment from run-time, such as on a different machine. It only happens once, whereas run-time can repeat many times.

A macro can be designed to that it opens a specific file, reads the content and generates some code based on that (or simply includes the file as a literal constant). That file exists only on the build machine, perhaps part of the source tree of the program. Thus, compiled code containing the macro call can run anyhere, but source code containing the macro cannot be evaled anywhere.

timonoko 2 days ago

Hey Grok: Does commonlisp have some mechanism to prevent malformed macro to do things globally, so that eval works differently than compile?

  Grok: Yes.
  < 5 pages of semi-incomprehensible explanations omitted >