After much struggle, I was able to write a test that distinguishes the variable computation ordering on master from the ordering on defer-recompute-test ... but I'm not positive that it demonstrates that the change in ordering is what we desire it to be, so read carefully.
The meaningful difference between the two branches is on the line commented in the test case below. On the current master, at the time that the gen generator cell is first fulfilled, the actual generator has not resumed yet after its initial yield, and the value of i is still 1.
On the defer-recompute branch, at the time that the gen generator cell is first fulfilled, the generator has already resumed, and although the current value being yielded through the runtime is 1, i already equals 2.
After much struggle, I was able to write a test that distinguishes the variable computation ordering on master from the ordering on defer-recompute-test ... but I'm not positive that it demonstrates that the change in ordering is what we desire it to be, so read carefully.
The meaningful difference between the two branches is on the line commented in the test case below. On the current master, at the time that the
gen
generator cell is first fulfilled, the actual generator has not resumed yet after its initial yield, and the value ofi
is still1
.On the defer-recompute branch, at the time that the
gen
generator cell is first fulfilled, the generator has already resumed, and although the current value being yielded through the runtime is1
,i
already equals2
.Is this the behavior we want?