proposal-eventual-send
proposal-eventual-send copied to clipboard
is the "reentrancy protection" description accurate?
The README (around line 162) says:
To protect against reentrancy, the proxy internal method postpones the
execution of the handler trap to a later turn, and immediately returns a
promise for what the trap will return. For example, the [[EventualGet]] internal
method of a delegated promise is effectively
p.then(t => h.eventualGet(t, prop))
My reading of that suggests that the handler doesn't get control until the original Promise is resolved, which seems too late to be useful. Would it be more accurate to say something like?:
Promise.resolve().then(t => h.eventualGet(t, prop))
This also shows up a few paragraphs later (line 194) in the discussion of GetSendOnly
(which, as https://github.com/tc39/proposal-eventual-send/issues/6#issuecomment-563692328 points out, is probably not the best example to use.. the pair should probably be replaced with eventualSend
and eventualSendOnly
).