00:12
<shu>
would be interested in your take on what shifts in the ecosystem if V8 just stops doing that work; not that I advocate for that outcome, but I assume you've gamed that scenario out?
sure, ping me some time
01:02
<Marja Hölttä (not here, use marja@google.com)>
We have been trying to identify any real slowdowns and don’t see one in V8. If anyone is experiencing a slowdown of private compared to public in V8, I would love to hear from you; maybe we could sponsor work to do the appropriate optimization.
what kind of measurements / benchmarks did you use for this?
01:22
<Mathieu Hofman>
Well if regulators force Chrome to be spun off Google I expect the funding economics of the Web would drastically shift too
02:31
<Aki>
Do we keep a list of what we consider a stage 4-eligible implementation?
02:35
<rkirsling>
> shipping implementations, such as that provided by two independent VMs I feel like this is one of those "has a very concrete meaning in practice and needs to be kept abstract on paper" things
02:37
<rkirsling>
(also why tf does Element for Android not allow typing formatted text)
02:39
<Aki>
So in practice, JSC, SpiderMonkey, or V8 and that's that?
02:42
<rkirsling>
in theory others like XS should count but the shipping experience as "proof that the web didn't break" is so important
06:30
<ljharb>
they do count when web compat isn’t a concern
06:31
<ljharb>
i have an open PR on the process doc that suggests we should define “risk areas” for each proposal, and use those to inform what counts - ie, what reassurances are most needed
06:33
<nicolo-ribaudo>
Process proposal to make a proposal's title blink if it changes Array.prototype
09:01
<nicolo-ribaudo>

Weak{Set,Map}.prototype.clone() -- does anybody see any obvious problem with the idea?

My use case is that I need an immutable weakset. For Set it's easy (just do new Set(oldSet).add(newElement)), but for weak collections it's quite complex to do it and it involves manually duplicating the contents in a list of WeakRefs

09:02
<nicolo-ribaudo>

My ClonableWeakSet implementation:

class ClonableWeakSet extends WeakSet {
  #contents = [];
    
  #indexes = new WeakMap();

  #cleanup = new FinalizationRegistry(() => {
    if (Math.random() < 0.1) this.#compact();
  });

  #compact() {
    let oldIndex = 0, newIndex = 0;
    while (oldIndex < this.#contents.length) {
      const obj = this.#contents[oldIndex]?.deref();
      if (obj !== undefined) {
        this.#contents[newIndex] = this.#contents[oldIndex];
        this.#indexes.set(obj, newIndex);
        newIndex++;
      }
      oldIndex++;
    }
    this.#contents.length = newIndex;
  }

  add(value) {
    super.add(value);
    if (!this.#indexes.has(value)) {
      this.#indexes.set(value, this.#contents.length);
      this.#contents.push(new WeakRef(value))
      this.#cleanup.register(value);
    }
    return this;
  }

  delete(value) {
    const res = super.delete(value);
    if (this.#indexes.has(value)) {
      this.#contents[this.#indexes.get(value)] = null;
      this.#indexes.delete(value);
      this.#cleanup.unregister(value);
    }
    return res;
  }

  clone() {
    const cloned = new ClonableWeakSet();
    this.#contents.forEach(ref => {
      const obj = ref.deref();
      if (obj !== undefined) cloned.add(obj);
    });
    return cloned;
  }
}
09:18
<ljharb>
how would the values be "cloned"? or would it just put the same === items in both WMs/WSs?
09:19
<nicolo-ribaudo>
Yes, same items
09:19
<nicolo-ribaudo>
It's like doing new Set(oldSet), except that you cannot do this with WeakSets because they are not iterable
09:21
<nicolo-ribaudo>
And this would be much easier to implement in engines than in userland, because engines can iterate over WeakSet contents
09:31
<Justin Ridgewell>
Why not build a wrapper over a WeakSet that prevents writes?
09:32
<nicolo-ribaudo>
I trust my code to not mutate the WeakSet, so I don't need to prevent writes
09:33
<nicolo-ribaudo>
I need to keep around both the old one and the new one
09:36
<nicolo-ribaudo>
Oh, I found https://github.com/tc39/proposal-readonly-collections/issues/2. WeakSet.prototype.diverge() is exactly what I need
12:18
<Richard Gibson>
not all implementations can iterate over WeakSet contents; XS in particular uses an inverted approach that would not support this
12:20
<yulia>
Tg5 workshop photo