I’m having trouble understanding how they’re different from the macro hygiene that Julia already does by default
Macros in Julia are only allowed to be defined in the global scope. What this means is that I am not allowed to build a function or macro which defines a macro:
julia> function make_greeting_macro(greeting)
return :( println(greeting, $name) )
ERROR: syntax: macro definition not allowed inside a local scope
Wanting to make macros or functions that make macros is a pretty rare use case but its not unimaginable.
Do you have a sense of what a lexically scoped macro could do that Julia macros can’t?
In the thread I linked to in my original post, the lisper who replied to me showed a neat macro he made which is passed a function and a list of symbols. The macro then returns the original list with the specified function applied only to the variables which were unbound.
I doubt such functionality is impossible to replicate in Julia but it certainly is impossible the way he did it. His macro works by defining a new macro in that local context which is passed an environment variable which contains information about the local scope and the variables which are defined there.
To be clear, I don’t really know how useful these lexical macros actually are but I’d like to understand why we don’t allow them and if there isn’t a good reason to allow them I think they should be allowed even if we can’t currently divine a super critical use for them right now.