jisp
jisp copied to clipboard
Macros and hoisting-embedding
Right now, there’s a difference between macros and global functions in the way they are hoisted and embedded. Functions respect the file’s scope and allow the user to override them: if a function is reassigned in the top scope before being referenced by name, it’s not embedded. Macros don’t allow themselves to be overridden and are embedded even if “reassigned” (referenced like (= myMacro ‘stuff’)).
We need to allow the user to reassign and reuse macro names in a similar way as with global functions. If a macro’s name is reassigned before a macro call, the macro should be blacklisted and ignored for the duration of this particular call of the compile function or this REPL session.