-
-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Eliminate forward declarations for recursive macros. #64
Comments
I should mention that the forward declaration is only required if the recursive macro invocation isn't qualified. But remembering to qualify it yourself is no easier than a forward declaration. The defmacro machinery should be able to do it for you somehow. Making defmacro a reader macro wouldn't help, because inner reader macros evaluate first when composed, and unlike compiler macros, are not recursive. Making defmacro expand to the forward declaration and then the definition in a Some possible solutions: Option 1: Make template symbol in the function position expand to something like Option 2: Make the templates always qualify symbols in the invocation place as a macro, and then make the compiler itself fall back to evaluating it like a global if there's no macro with that name. This is already similar to how the compiler handles unqualified symbols: assume macro first, and then fall back to global. It would make sense to assume an unqualified symbol in a template would act the same way. I like this better, however, it is confusing to see an explicit Option 3: Make the templates qualify symbols in the invocation place in some third way, like |
duplicate of #55 |
Recursive macros currently require an explicit forward declaration. The template quote has to know at read time if an unqualified symbol should be qualified as a global or as a macro. In principle, defmacro shouldn't need this, because the macro name is provided. But by the time defmacro knows the symbol for the new macro, read time has passed and the template is already qualified.
The text was updated successfully, but these errors were encountered: