02:49
<sideshowbarker>
now I’m confused by the statement “you can think of a WeakSet as a special case of WeakMap where all the values are booleans” in https://v8.dev/features/weak-references
02:49
<sideshowbarker>
Mathieu Hofman: ⬆️
02:51
<sideshowbarker>
I see nothing in the spec for WeakSet at https://tc39.es/ecma262/multipage/keyed-collections.html#sec-weakset-objects about the values being restricted to being booleans
02:58
<sideshowbarker>
or is that “you can think of a WeakSet as a special case of WeakMap where all the values are booleans” statement just an odd way of saying you can think of a set as a map that only has keys without values?
03:04
<sideshowbarker>
…and so, further in https://v8.dev/features/weak-references, I’m confused by the statement _“adding an object as a key to a _ — which makes sense for a WeakMap but does not seem to make sense for a WeakSet, since a WeakSet doesn’t have keys
03:07
<sideshowbarker>
And then there’s A JavaScript WeakMap is not really weak: it actually refers strongly to its contents as long as the key is alive — which also makes sense just fine but would not seem to make sense for a WeakSet
03:08
<Mathieu Hofman>
It's like if WeakSet only had keys, no values
03:09
<sideshowbarker>
ok
03:11
<sideshowbarker>
I guess I’ll try writing up a concrete patch myself for the MDN WeakMap and WeakSet docs to make them accurate — and then to add the clarification about why they are not enumerated
03:22
<Mathieu Hofman>

I think the important part is that WeakMap and WeakRef provide orthogonal features.

WeakMap allows associating data to objects in a way that doesn't prevent the object keys from being collected, even if the values in the weak map reference the keys. However, WeakMap doesn't allow observing the liveness of the keys, which is why it doesn't allow enumeration.

WeakRef, being a real weak reference, allows to directly observe the liveness of an object. However you cannot build a WeakMap from WeakRef and Map, as that would prevent collection of cycles.

You could combine WeakRef and WeakMap to build an IterableWeakMap which allows enumeration. See https://github.com/tc39/proposal-weakrefs/#iterable-weakmaps

20:31
<devsnek>
bakkot: have you seen deepgram api? i have no idea how good it is but it looks like its very intentionally designed for the kind of thing your note taking bot does
20:36
<bakkot>
I have not, but that does look good
20:36
<bakkot>
I'll try it out if I find myself with a free evening one of these days
20:37
<bakkot>
Claims lower latency than google's STT, which would be very nice
21:24
<devsnek>
whelp i couldn't get it to work with my discord transcription bot, with either the raw ws or the sdk. it seems like the websocket never gets to the open state. i'm probably doing something wrong though.