12:47
<snek>
littledan: in the node impl its super(AsyncContextFrame.current()) and in the deno impl its {...previousContextMapping}. There's no efficient copy-on-write structure available in js like there is in native code
14:00
<littledan>
littledan: in the node impl its super(AsyncContextFrame.current()) and in the deno impl its {...previousContextMapping}. There's no efficient copy-on-write structure available in js like there is in native code
it should be possible to implement a HAMT in JS, shouldn't it? (hash based on an incrementing number that each Variable has)
14:00
<littledan>
or, equally, the simple linked list model (good enough sometimes--all web frameworks do this)
15:35
<Stephen Belanger>
A linked list of contexts is what I was going for originally, but it makes things uncollectable even if they’ve been replaced in the store because they are held further up in the linked list. Needed to do the map clone approach for reasonable memory characteristics.
15:35
<littledan>
you can use a HAMT for this (the engine doesn't have special powers that JS doesn't have)
15:35
<littledan>
https://en.wikipedia.org/wiki/Hash_array_mapped_trie
15:36
<littledan>
in particular a "persistent" one
15:36
<littledan>
I think engines would not implement this with a linked list plus magical GC