On Oct 28, 2014 10:18 PM, "Fabrício Matté" <[email protected]> wrote: > > What I mean is, consider this code: > > ```js > var wsRef = new WeakSet(); > var wsRef2 = wsRef; > wsRef.clear(); > ``` > > As far as I can see, in the `wsRef.clear()` algorithm, the `this` value has no relation with the `wsRef` identifier. Even if there was some internal magic around changing the identifier's reference, there would still be other references pointing to the old WeakSet object. So your proposal seems to require replacing an object in the memory with another while keeping the references intact, which (I believe) does not exist in ECMAScript. > > I may be wrong though, let's other for someone with more experience than me to have a say. `=]` >
Not in pure ECMAScript being interpreted, but it can definitely be done in the implementation. On Oct 28, 2014 10:18 PM, "Fabrício Matté" <[email protected]> wrote: > > What I mean is, consider this code: > > ```js > var wsRef = new WeakSet(); > var wsRef2 = wsRef; > wsRef.clear(); > ``` > > As far as I can see, in the `wsRef.clear()` algorithm, the `this` value has no relation with the `wsRef` identifier. Even if there was some internal magic around changing the identifier's reference, there would still be other references pointing to the old WeakSet object. So your proposal seems to require replacing an object in the memory with another while keeping the references intact, which (I believe) does not exist in ECMAScript. > > I may be wrong though, let's other for someone with more experience than me to have a say. `=]` You can't in plain ECMAScript interpreted, but you definitely can in the implementation backend.
_______________________________________________ es-discuss mailing list [email protected] https://mail.mozilla.org/listinfo/es-discuss

