# Note in ‘liveness’ section appears to be normative

**URL:** <https://es.discourse.group/t/note-in-liveness-section-appears-to-be-normative/1345>\
**Category:** I have questions\
**Created:** [May 16, 2022, 5:35pm UTC](https://es.discourse.group/t/note-in-liveness-section-appears-to-be-normative/1345 "2022-05-16T17:35:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![aclaymore](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/aclaymore/32/501_2.png) [@aclaymore](https://es.discourse.group/u/aclaymore)\
**Post date:** [May 16, 2022, 5:35pm UTC](https://es.discourse.group/t/note-in-liveness-section-appears-to-be-normative/1345/1 "2022-05-16T17:35:48Z")

</div>

When reading the spec’s section on liveness:

[https://tc39.es/ecma262/multipage/executable-code-and-execution-contexts.html#sec-liveness](https://tc39.es/ecma262/multipage/executable-code-and-execution-contexts.html#sec-liveness)

and

[https://tc39.es/ecma262/multipage/executable-code-and-execution-contexts.html#sec-weakref-execution](https://tc39.es/ecma262/multipage/executable-code-and-execution-contexts.html#sec-weakref-execution)

There is a note that says:

> If an implementation chooses a non-[live](https://tc39.es/ecma262/multipage/executable-code-and-execution-contexts.html#sec-liveness) set S in which to empty [WeakRefs](https://tc39.es/ecma262/multipage/managing-memory.html#sec-weak-ref-constructor), it must empty [WeakRefs](https://tc39.es/ecma262/multipage/managing-memory.html#sec-weak-ref-constructor) for all objects in Ssimultaneously. In other words, an implementation must not empty a [WeakRef](https://tc39.es/ecma262/multipage/managing-memory.html#sec-weak-ref-constructor) pointing to an object obj without emptying out other [WeakRefs](https://tc39.es/ecma262/multipage/managing-memory.html#sec-weak-ref-constructor) that, if not emptied, could result in an execution that observes the Object value of obj.

Am I correct that this note is not purely clarifying, and instead is normative. Without this note the spec seems to allow the following:

```javascript
let a = {};
let b = {};
a.b = b;
let ra = new WeakRef(a);
let rb = new WeakRef(b);
a = b = null;
await sleep(1);
// host considers the set of objects: [b] non-live and empties rb
assert(rb.deref() === undefined);
// but the set of objects: [a] has not been cleared so…
assert(ra.deref().b !== undefined);

```

Feel like I must be missing something?

---

<div class="post-metadata">

**Author:** ![aclaymore](https://yyz2.discourse-cdn.com/free1/user_avatar/es.discourse.group/aclaymore/32/501_2.png) [@aclaymore](https://es.discourse.group/u/aclaymore)\
**Post date:** [May 16, 2022, 6:00pm UTC](https://es.discourse.group/t/note-in-liveness-section-appears-to-be-normative/1345/2 "2022-05-16T18:00:34Z")

</div>

@shu has explained where I’m getting mixed up .

The weakref-oblivious execution is not an execution where _all_ weakRef targets are empty, but only where the weakref target is an object in the currently under consideration set of objects.
