Open masak opened 5 years ago
Indeed. I ran the above, and:
false
none
none
It's a bug.
In a way, I was right six-seven years ago when I said to @moritz++ that ASTs (Qtrees) close over their environment. The only refinement I would make to that today is that it's the individual variables (well, their Qnodes) that "close over" their environment — by binding direct to their (unique) memory location — and it only happens to variables bound outside the quasi.
Haven't checked this, but I have a feeling the following fails:
That is... there's only one variable
x
in the script, and of the two injectiles generated, they will be indistinguishable in structure and behavior (they'll both printnone
and a newline), but the two injectiles do differ in that they're locked onto differentx
locations. (And that difference matters.)(So the code ought to output
true none none
on separate lines.)Again, I haven't run the code above, but I have a sneaking suspicion we're not distinguishing. We should be.
Even if we accidentally get this one right, it deserves to be turned into a test.