I understand that objects are passed by reference in Java (similarly to
ECMAScript), however I'm not sure how implementations link Lexical
Environments' identifiers to their respective values, and re-mapping these
would be more complicated than the C++ sample you've posted I believe.​

As far as I can see, this seems a lot more complicated than it is worth,
and it would at least require a new abstract operation for internally
in-place replacing objects while keeping references intact.

Wouldn't it be far easier to just have an internal data property in each
Weak(Map|Set) which can be replaced by a new list/object? Then
implementations can just access/pass-by-reference the Weak(Set|Map) object
and methods can read its data property. In fact, that seems to be what the
spec already does:

> ### [23.3.3.1 WeakMap.prototype.clear ( )](
https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakmap.prototype.clear
)
> ...
> 5. Set the value of M’s [[WeakMapData]] internal slot to a new empty List.

And

> ### [23.4.3.2 WeakSet.prototype.clear ( )](
https://people.mozilla.org/~jorendorff/es6-draft.html#sec-weakset.prototype.clear
)
> ...
> 5. Set the value of S’s [[WeakSetData]] internal slot to a new empty List.

How would your proposal simplify those algorithms?
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to