22:15
<shu>
we might've accidentally made template literal arrays eternal again?
22:16
<shu>
we (chrome) recently discovered the note for [[TemplateMap]] in https://tc39.es/ecma262/#table-realm-record-fields is not true, because, well, WeakMaps and WeakRefs exist
22:44
<Ashley Claymore>
It seems to just not be true in general. The array could still be reachable by anything live having a reference to it. The array can be passed around. Unless it means the literal accessing of the [[array]] field rather than the value?
22:45
<shu>
good point, i think that note is probably in general wrong
22:46
<shu>
but the original intention was assuming no live strong references to the template array, we could collect it if the parse node was no longer reachable
22:47
<Ashley Claymore>
That seems OK? Even if the array is in a WeakRef. Or is there a risk to making that collection observable?
22:48
<shu>
but it is not in fact unobservable to collect them, because of weakrefs
22:48
<shu>
i think we should clarify that note because it's saying a collecting implementation strategy is allowed because of unobservability, which is false
22:49
<shu>
maybe we don't need to say anything more than "it's observable in weak collections and weakrefs and that's fine"
22:50
<shu>
it's also not very clear to me what a Parse Node becoming unreachable means
22:51
<shu>
now that we talk about liveness for other things in the spec, we should give these the same treatment
22:51
<Ashley Claymore>
When can parse nodes be collected? Eval and script tags?
22:51
<shu>
beats me!
22:51
<shu>
they're technically spec fiction
22:51
<shu>
oh no, maybe not, because functions hold on to them?
23:05
<bakkot>
yeah, functions hold on to them
23:05
<bakkot>
and that's how you'd normally re-manifest it: () => tag`foo` or whatever
23:10
<shu>
but the only way we would collect them is if the toplevel Script or Module that has the root Parse Node itself becomes unreachable at some point
23:10
<shu>
and that i guess is currently up to the host
23:41
<bakkot>
the Script is not reachable from code, from the POV of the spec
23:41
<bakkot>
like if you just have tag`foo` in your program, not in a closure, then after the main body of the script runs you can collect the array for that template
23:41
<bakkot>
(ignoring WeakRefs, and assuming tag doesn't create a longer-lived reference)
23:43
<shu>
isn't the entry point to parse a script from the host though?
23:45
<shu>
anyway that part isn't so important
23:46
<shu>
we should say that the liveness of the template array literal is tied to the liveness of the Parse Node, which may be observed by weak collections and weak refs