Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upImplement meta-object trap(s) to make an object's [[Prototype]] immutable #538
Comments
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
domenic
Apr 12, 2016
Member
Yay!
on most objects) a [[MutablePrototype]] Boolean internal slot indicating mutability (initially true).
I think this woudl be better integrated into [[Extensible]]. So instead of being a boolean, [[Extensible]] becomes a tri-state "extensible", "immutable prototype", "non-extensible". It isn't possible to have an object that is non-existensible but with a mutable prototype, so a two-boolean design gives too many degrees of freedom.
|
Yay!
I think this woudl be better integrated into [[Extensible]]. So instead of being a boolean, [[Extensible]] becomes a tri-state "extensible", "immutable prototype", "non-extensible". It isn't possible to have an object that is non-existensible but with a mutable prototype, so a two-boolean design gives too many degrees of freedom. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ljharb
Apr 12, 2016
Member
In order to add a proxy trap, a corresponding Reflect method would need to be added. I suspect this would need to be part of a full proposal and maybe wouldn't be able to be just a PR.
|
In order to add a proxy trap, a corresponding Reflect method would need to be added. I suspect this would need to be part of a full proposal and maybe wouldn't be able to be just a PR. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
bterlson
Apr 12, 2016
Member
Agree with @domenic, s/[[Extensible]]/[[Extensibility]] and tri-state seems good.
|
Agree with @domenic, s/[[Extensible]]/[[Extensibility]] and tri-state seems good. |
added a commit
to jswalden/ecma262
that referenced
this issue
Apr 12, 2016
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jswalden
Apr 12, 2016
Contributor
https://github.com/jswalden/ecma262/tree/setimmutableprototype is the current quasi-state of what I have. It adds the extra [[MutablePrototype]] thing, rather than the [[Extensibility]] thing mooted already. The issue is that it only adds one trap, [[SetImmutablePrototype]], right now. But another is needed (or so it seems) to expose whether the [[Prototype]] is immutable. See the XXX bits in the branch above (and tell me how to attach its current state here, rather than literally just linking it). Does it seem like two additional traps are required here, or is there some other better approach for this?
|
https://github.com/jswalden/ecma262/tree/setimmutableprototype is the current quasi-state of what I have. It adds the extra |
jswalden commentedApr 12, 2016
This is followup on making the global object's
[[Prototype]]chain immutable. It was agreed that a proposal to extend this to be a full proxy trap, so that ordinary objects and arrays and so on could have immutable[[Prototype]], would be entertained, and I'd write up the spec-proposal for it. Said spec-proposal isn't complete yet, but I have an approximate start on it thus far.Right now the gist of the idea is to add a
[[SetImmutablePrototype]]trap and (on most objects) a[[MutablePrototype]]Boolean internal slot indicating mutability (initially true). I have this completed, generally sensibly enough, except for a few issues still. I'll post my current, un-landable progress after filing this issue and figuring out how to attach that progress.