diff --git a/spec/abstract-jobs.html b/spec/abstract-jobs.html index 5fb5ff3..307aed4 100644 --- a/spec/abstract-jobs.html +++ b/spec/abstract-jobs.html @@ -100,6 +100,33 @@
- NOTE: The exact guarantee remains under discussion in - #115. -
-WeakMap and WeakSet keys are not kept alive just because a WeakRef points to them.
++ WeakMap and WeakSet keys are not kept alive just because a WeakRef points + to them. This proposal rephrases the definition of WeakMaps and WeakSets + to explain their observable effects on garbage collection, rather than + specifying operationally that non-live keys or members are deleted. +
-WeakMap objects are collections of key/value pairs where the keys are objects and values may be arbitrary ECMAScript language values. A WeakMap may be queried to see if it contains a key/value pair with a specific key, but no mechanism is provided for enumerating the objects it holds as keys. If an object that is being used as the key of a WeakMap key/value pair is only reachable by following a chain of references that start within that WeakMap, or if all references to a ECMAScript object are from a [[Target]] field or internal slot, then that key/value pair is inaccessible and is automatically removed from the WeakMap. WeakMap implementations must detect and remove such key/value pairs and any associated resources.
-+ Open questions remain under discussion about the relationship between when + elements are collected in WeakMaps, WeakSets and WeakRefs, e.g., + what guarantees are made about timing, c.f. + #121 (comment). +
+WeakSet objects are collections of objects. A distinct object may only occur once as an element of a WeakSet's collection. A WeakSet may be queried to see if it contains a specific object, but no mechanism is provided for enumerating the objects it holds. If an object that is contained by a WeakSet is only reachable by following a chain of references that start within that WeakSet, or if all references to a ECMAScript object are from a [[Target]] field or internal slot, then that object is inaccessible and is automatically removed from the WeakSet. WeakSet implementations must detect and remove such objects and any associated resources.
-WeakMap objects are collections of key/value pairs where the keys are objects and values may be arbitrary ECMAScript language values. A WeakMap may be queried to see if it contains a key/value pair with a specific key, but no mechanism is provided for enumerating the objects it holds as keys. There is no way for ECMAScript programs to observe the presence of a key in a WeakMap without a reference to that key. This implies that, if an object is not live, and it is present as a WeakMap key, then the implementation may unobservably remove the key-value pair from the WeakMap. If an object that is being used as the key of a WeakMap key/value pair is only reachable by following a chain of references that start within that WeakMap, then that key/value pair is inaccessible and is automatically removed from the WeakMap. WeakMap implementations must detect and remove such key/value pairs and any associated resources.
WeakSet objects are collections of objects. A distinct object may only occur once as an element of a WeakSet's collection. A WeakSet may be queried to see if it contains a specific object, but no mechanism is provided for enumerating the objects it holds. There is no way for ECMAScript programs to observe the presence of an object held in a WeakSet without a reference to that object. This implies that, if an object is not live, and it is held in a WeakSet, then the implementation may unobservably remove the object from the WeakSet. If an object that is contained by a WeakSet is only reachable by following a chain of references that start within that WeakSet, then that object is inaccessible and is automatically removed from the WeakSet. WeakSet implementations must detect and remove such objects and any associated resources.