[TMACRO-3] Handling of namespaced symbols Created: 04/Sep/13 Updated: 10/Sep/13
|Reporter:||Dmitry Groshev||Assignee:||Konrad Hinsen|
Here is a snippet:
It's broken, the error is "Unable to resolve symbol: type$ in this context". Why is it so? Let's macroexpand it:
Now, the reason is obvious: symbol-macrolet expects namespaced symbol, and in expanded form "type$" is once namespaced and once not. I think that symbol-macrolet can (should?) ignore namespacing here.
|Comment by Konrad Hinsen [ 10/Sep/13 4:09 AM ]|
After a bit of thought, I think the right solution is to treat symbol macros like ordinary symbols in evaluation. This means that global definitions (defsymbolmacro) use namespaced symbols, whereas local symbol definitions (symbol-macrolet) accept only plain symbols and raise an exception for qualified symbols, just like let does.
With those rules, the way tools.macro handles namespaces in correct code is correct, but it doesn't do the required error handling because it lets you symbol-macrolet qualified symbols.
Note also that according to those rules, your example code is not correct. You have to write
although you might then prefer to write the latter as
but that's a matter of taste.