Can't distinguish binding/use of variables
In
(trigger {test ?var} (trigger {second ?var} ?var))
does {second ?var} show a use of the test binding, or a new shadowing binding?
If we distinguish binding (?var) from use (var), then
(trigger {test ?var} (trigger {second var} var))
(trigger {test ?var} (trigger {second ?var} var))
would show use and shadowing binding, respectively.
Some changes were made in de2e31e217b59f9ef31f23cb62e0bc76b860af64, but need to see what is left to do.
With 8000ae010b13d176e0e869f29f181feac2b0ef9a we are a bit closer – var (rather than ?var) is handled correctly when it's a name variable, but not as a process variable.
What's needed to finish this (at least) is converting substitute-variables to return the substituted value, rather than modifying it in place. This should give us a similar behavior for process variables as we currently have for name variables.
Then, we need to fix things so we don't need to 'var, but that can wait. At least things will work at that point.
Here is a test case for what is left to do
(trigger {test-use ?y} (trigger {use y} {should-be-use y}))
(trigger {test-shadow ?y} (trigger {shadow ?y} {should-be-shadow y}))
{test-use {use}}
{use {shadow}}
{test-shadow {use}}
{shadow {shadow}}
substitute-variables is now non-mutating, and I added a method on SYMBOL, so the above example now works if you convert all the bare instances of y to 'y. Now to get rid of that quote …
The remaining bit of this may be related to issue #1. I basically need to do a thorough review of what gets evaluated when.
I added the test-case above to the source.