There are a number of permutations of this that we need to think about. Specifically:
"run, enter, end-run, dispose" - probably should not restore the 2.
const x = v.withValue(1);
v.run(2, () => x[Symbol.enter]());
x[Symbol.dispose]();
"enter, run, dispose, end-run" - probably should not restore the 1.
const x = v.withValue(1);
x[Symbol.enter]();
v.run(2, () => x[Symbol.dispose]());
"enter A1, enter A2, dispose A1, dispose A2" - probably should not restore the 1.
const x1 = v.withValue(1);
const x2 = v.withValue(2);
x1[Symbol.enter]();
x2[Symbol.enter]();
x1[Symbol.dispose]();
x2[Symbol.dispose]();
Two separate variables - very similar to the previous one, but maybe a non-issue if different vars are completely independent here?
const x1 = v1.withValue(1);
const x2 = v2.withValue(2);
x1[Symbol.enter]();
x2[Symbol.enter]();
x1[Symbol.dispose]();
x2[Symbol.dispose]();
There are a number of permutations of this that we need to think about. Specifically:
"run, enter, end-run, dispose" - probably should not restore the
2."enter, run, dispose, end-run" - probably should not restore the
1."enter A1, enter A2, dispose A1, dispose A2" - probably should not restore the
1.Two separate variables - very similar to the previous one, but maybe a non-issue if different vars are completely independent here?