You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Then everything works as expected. But, if you delete the reference to j, save, and then restore the reference to j, then j will resolve to undefined instead of incrementing once per second. I would guess that this has something to do with the generator being consumed lazily, and something bad is happening if there is no longer a downstream observer. 🤔
The text was updated successfully, but these errors were encountered:
The combination of this means that the generator is terminated when the associated variable is no longer reachable. But the problem is resumption: recomputing the variable j doesn’t create a new generator; it simply returns the existing one that was returned by cell 42. And since that generator has already been returned, the subsequent call to generator.next returns {done: true, value: undefined}.
I think probably this means that variables that are no longer reachable should not be invalidated — they’re still valid, just not reachable. But that means that a variable that becomes reachable doesn’t necessarily need to be computed. And it means that we don’t want to keep pulling from the generator while it’s not reachable; we should wait until it becomes reachable again. 🤔
For example, given this generator:
If you reference the value of
j
like so:Then everything works as expected. But, if you delete the reference to
j
, save, and then restore the reference toj
, thenj
will resolve to undefined instead of incrementing once per second. I would guess that this has something to do with the generator being consumed lazily, and something bad is happening if there is no longer a downstream observer. 🤔The text was updated successfully, but these errors were encountered: