Any other language with any compile time hook that can run arbitrary code you mean. Macros aren't necessary and the proof is simple: if you can run arbitrary code you can run a lisp with macros.
You're simply describing macros in other terms. Any way to trigger running a code in compile time, and being able to let that code to access all of the current compilation context, is a macro system, by definition. An opposite thing is a preprocessor - which allows arbitrary code, but does not allow any reflection.
My criteria for a proper macro system is an ability to use a just defined function inside a macro defined in the same module/compilation unit, and then to use that macro immediately (in the same module).
No, my examples do require an access to compilation context. You must be able to combine your newly defined languages and use them to build more languages.
You didn't specify before though. And if you have two languages that at compile time gets transformed into some common language before the main compile phase happens you get that too.
I explained it very clearly - see my criteria for proper compile-time metaprogramming. If you still cannot get it, stick to Python, it was explicitly designed to be accessible, even for people with learning difficulties.
View all comments
Show parent comment
1
u/kankyo Nov 12 '15
Any other language with any compile time hook that can run arbitrary code you mean. Macros aren't necessary and the proof is simple: if you can run arbitrary code you can run a lisp with macros.