domenic / get-originals

A web platform API that allows access to the "original" versions of the global built-in objects' properties and methods
28 stars 1 forks source link

Non-modifiable originals #24

Open guybedford opened 5 years ago

guybedford commented 5 years ago

This whole proposal is really great and exciting to see.

Ideally it would be nice if the originals could be non-modifiable, since even with this proposal, dangling properties on the functions or objects can still intercept and change usage between modules.

In addition there should surely be optimization benefits in being to having objects that know not to expect mutation surprises.

Object.freeze could work for anything that isn't possible to subclass.

For globals that support subclassing, we may still need a new type of non-modifiable primitive though.

littledan commented 5 years ago

I'm not sure about this. If originals are non-modifyable, they need to have a separate identity. This makes it basically a separate iframe per iframe, semantics-wise, with all the implied memory costs, and points back to the previous design (with all its issues) to avoid the overhead. I'm not really sure why this freezing would be helpful for JS developers.