Currently, `Object.freeze`ing a prototype affects all objects "inheriting" from the prototype when trying to modify props on an inheriting object when those same props exist on the prototype, which isn't the behavior that I want.
I'd like to prevent a prototype from being modifiable directly, but I still want objects that "inherit" from the prototype to work like normal (i.e. they can still shadow properties of the prototype and the object will be modified directly rather than the prototype). For example, the following is my problem: ```js prototype.foo = "foo" Object.freeze( prototype ) const o = Object.create( prototype ) o.foo = "bar" // I want this to work (but it doesn't) prototype.foo = "baz" // and I want only this to fail because it is modifying the prototype directly ``` In otherwords, I'd like for inheritance (reading values from the prototype, and shadowing the prototype) to work like normal, but I don't want someone to grab the prototype and modify it directly and affect all other instances of the "class". Is there some way to do this currently? If not, I'd like to have such a feature so that only instances of my classes can be modified, but all prototypes in the inheritance are not. I'm also noting that Object.seal and Object.preventExtensions behave the same way (they affect object that inherit from the prototype which is what I want to avoid). */#!/*JoePea
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

