tc39 / proposal-defer-import-eval

A proposal for introducing a way to defer evaluate of a module
https://tc39.es/proposal-defer-import-eval
MIT License
208 stars 12 forks source link

fix reentrancy invariant #39

Closed guybedford closed 4 months ago

guybedford commented 4 months ago

This implements an approach to the reentrancy invariant described in https://github.com/tc39/proposal-defer-import-eval/issues/38, in implementing a ValidateSyncExecution routine that runs before the sync evaluation call and checks for any states in the graph associated with reentrancy to skip sync execution in that case.

This would permit the case as described in #38 since it is dealing with disjoint graphs. It is only when the unexecuted parts of the graph overlaps with an in-progress execution that execution would be skipped.

An alternative to skipping execution could still be to throw a reference error.