Proxy trap invariant gotchas
jdalton opened this issue · comments
Something I've been bitten by in the past is the various proxy trap invariants that you have to be aware of when projecting one value in place of another. I ended up with helpers like isUpdatableDescriptor
, isUpdatableGet
, and isUpdatableSet
.
This can rear up when projecting over non-configurable or frozen properties.
Update:
It looks like some of the traps always return true
in places (here, here, here, here) which could be a spot for an invariant to throw.
Let's chat over this one, I'm not sure I understand the first part.
As for the second comment, those are explicit returns because if the control gets to the return statement is because the operation succeed on the shadow target, otherwise the invariant violation will happen on the shadow target itself. That might not be ideal because of the error stack, but the language invariant will be preserved I believe, let's chat about it.