Kilns icon indicating copy to clipboard operation
Kilns copied to clipboard

Can't distinguish binding/use of variables

Open sellout opened this issue 15 years ago • 7 comments

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.

sellout avatar Sep 29 '10 10:09 sellout

Some changes were made in de2e31e217b59f9ef31f23cb62e0bc76b860af64, but need to see what is left to do.

sellout avatar Oct 05 '10 13:10 sellout

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.

sellout avatar Oct 05 '10 23:10 sellout

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.

sellout avatar Oct 06 '10 01:10 sellout

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}}

sellout avatar Oct 06 '10 15:10 sellout

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 …

sellout avatar Oct 15 '10 15:10 sellout

The remaining bit of this may be related to issue #1. I basically need to do a thorough review of what gets evaluated when.

sellout avatar Oct 15 '10 15:10 sellout

I added the test-case above to the source.

sellout avatar Sep 04 '11 21:09 sellout