No, macros and eval are quite different. You can see this for example in Python or JavaScript, which have eval but not macros.
No, macros and eval are quite different. You can see this for example in Python or JavaScript, which have eval but not macros.
You can make macros in Python: https://github.com/lihaoyi/macropy (note that that project was started for a class taught by Sussman)
There's also a PEP to make them first-class: https://peps.python.org/pep-0638/
That's a different meaning of first-class from Strachey's definition of a first-class citizen[1] - ie, one that can be passed as an argument, returned from a function, or assigned to a variable.
Syntactic macros are still second-class, like Lisp macros, but an improvement over text-replacement style macros.
For something macro-like which is first-class, there are fexprs[2] and operatives (from Kernel[3]) - these receive their operands verbatim, like macros, so they don't require quotation if we want to suppress evaluation. fexprs/Operatives can be passed around like any other value at runtime.
[1]:https://en.wikipedia.org/wiki/First-class_citizen
[2]:https://en.wikipedia.org/wiki/Fexpr
[3]:https://web.cs.wpi.edu/~jshutt/kernel.html
Stratchey defined "first-class objects". This was by analogy with "first-class citizens" in a legal/political sense, since they are treated just as well as any other object and have no additional limitations. If we extend the analogy to syntax then I think it's clear enough that it means that it is a piece of syntax which is treated the same as any other and does not require special treatment or impose additional restrictions.
Thank you for the clarification and the additional information, I think having macros as first-class objects is a cool (but separate) idea.
They aren't that different. Fexprs are essentially additional eval cases.