A macro is a procedure that outputs a list, which is then evaluated in the caller's context. However, if a macro's returned list outputs a value and that value is given as an input to a procedure, then the list is evaluated in the context of the macro's body, instead of the caller.
Consider this output
.MACRO MACRO_THING :name
OUTPUT (LIST "THING WORD "" :name)
END
MAKE "name "value
MAKE "var "value
SHOW MACRO_THING "var
value
SHOW MACRO_THING "name
name
MACRO_THING "var outputs a list like [THING "var], which is correctly evaluated to the value of :var.
The same should be true of MACRO_THING "name. It outputs a list like [THING "name], but instead of evaluating to value of :name, it evaluates to the word name, presumably because that's the value that the parameter of MACRO_THING had when it was invoked.
Note that this is not true when a macro isn't used as an input
.MACRO MACRO_SHOW_THING :name
OUTPUT (LIST "SHOW "THING WORD "" :name)
END
MACRO_SHOW_THING "var
value
MACRO_SHOW_THING "name
value
This bug was reported as an incidental finding in Bug #598.
Here's a slightly simpler macro that shows the problem:
I have committed a fix for this as [r6114]. The fix will be available in whatever version follows 8.4.0.
The fix doesn't follow the UCBLogo code.
Related
Commit: [r6114]