if I say "macro" I mean real ones like in Lisp. Preprocessor macros like in C are sh*t in comparison.
I never used Lisp, but I know C. Can you show some examples?
Alexander
--
Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)
| [reply] |
We had this discussion multiple times before, but I can't find those threads in a hurry.
Preprocessing/source filter means you have an second parsing stage which has not only to reproduce the whole syntax (horror in Perl) but might also expand to unpredictable results when combined (like two source filters)
Lisp'ish Syntactic macros:
- look and parse like functions
- the arguments are used as building blocks for an "expanded" template
- the expansion happen while compiling in the same stage
- don't require any syntax parsing by themselves
- can be used to efficiently extend syntax
There are still some traps, like the need for "hygiene", but this a problem with dumber source filters too.
update
see also https://en.wikipedia.org/wiki/Macro_(computer_science)#Syntactic_macros
| [reply] |