Object.assign and super binding
On Nov 11, 2012, at 5:16 PM, Brandon Benvie wrote:
In implementing this I realized that all the possible ways to do what the spec tentatively says to do introduce a unique new ability or mechanic.
1.) A new function that has the same object identity and is a mirror, but has a differently set internal property. 2.) A mirror with a separate object identity but is otherwise the same and updates in real time. 3.) A shallow copy, which introduces a unique way to clone the internals of a function and get a new copy that can then diverge.
.#3 is what I intend, at least WRT the internal function state.
But you bring up a good question regarding what to do about expando properties that have been added to the source function. I suppose shallow copying them is reasonable. But I need to think some about the possibility of making the source function the [[Prototype]] of the new function. Then changes to the original's expandos would be visible to the copy and changes to the copy could only be visible via the copy...
In implementing this I realized that all the possible ways to do what the spec tentatively says to do introduce a unique new ability or mechanic.
1.) A new function that has the same object identity and is a mirror, but has a differently set internal property. 2.) A mirror with a separate object identity but is otherwise the same and updates in real time. 3.) A shallow copy, which introduces a unique way to clone the internals of a function and get a new copy that can then diverge.