Hacker News new | ask | show | jobs
by ImprobableTruth 2381 days ago
I wouldn't say they are a seperate language, but they definitely feel like a seperate layer. They're not first class objects like functions (so you can't pass them to functions) and you can't evaluate the arguments (since macros are only directly present during compilation/interpretation), it's purely a mapping from source code to source code. For example, you can't rewrite a list based on it's values or form. You can rewrite the list to a program that does the transformation when run, but the seperation feels very tangible to me. Something like FEXPRs would be closer to being "just the same as normal code", but there's good reason why macros are the way they are.
1 comments

You can absolutely pass a macro to a function. It's a list! What you can't do is use funcall or apply on it, because it isn't a function.

What you do is, you use macroexpand-1, like so:

https://stackoverflow.com/questions/50754347/macro-with-a-li...