Hacker News new | ask | show | jobs
by cestith 1510 days ago
C doesn't exactly have macros. That's a text substitution done by the preprocessor in its own limited, special-purpose language. True hygienic macros of something like Common Lisp are a different beast.

If all you want are textual substitutions, you can use the C preprocessor in front of any language.

3 comments

C macros are as abstract or even more abstract than hygienic macros https://github.com/BlueFlo0d/CSP https://github.com/FrozenVoid/C-headers/blob/main/argmanip.h
> you can use the C preprocessor in front of any language.

You will be paddling upriver if that language doesn't have a mostly C-compatible token structure, or has white space sensitivities that C preprocessing doesn't preserve and such.

The C Preprocessor has sensitivities that aren't matched by C in all cases. And in the case of Hare, the tokenisation should be close enough to C that the CPP would only break in the same ways it already does.
Common Lisp does have macros, but not hygienic macros.
Thanks for the correction.