00:01
<bakkot>
to be clear, I regard conflating them as desirable; state transitions should be as close to atomic as possible. but I don't actually see how it prevents a future option except in the sense that people could come to rely on it being atomic, which is a thing they can already rely on.
00:22
<rbuckton>
I see
00:54
<Richard Gibson>
it's totally doable in userland: capture outbound dependencies in a WeakMap with Array<{ ref: WeakRef<AbortSignal>, callbacks: AbortAlgorithmList }> values, implement AbortSignal.any to push a record for its signal under construction to the array of each root source (i.e., each non-dependent leaf found in a transitive source traversal as already specified for DOM AbortSignal.any), and implement abort to iterate over those records for the signal being aborted (unconditionally enqueueing callbacks, and marking the signal wrapped by ref as aborted unless it is already gone or aborted)
01:54
<Mathieu Hofman>

putting aside for a minute the "how" can you clarify the "why", aka:

But if not, then it should be GC'd

Why shouldn't the dependent signal object be GCed if no user references it? Its already registered callbacks will execute regardless since they're help by the not-dependent source. I had a requirement for something similar in my promise experiments, but it was very esoteric, so I'm curious how this came up for abort signal

02:26
<bakkot>
Ah, so, another detail is that the abort event listeners can observe the signal, with the addEventListener machinery. (And for dependent signals, it can observe both the dependent and the source.) I agree that if we are in a world without addEventListener there are more options, but we're not in that world.
02:28
<Mathieu Hofman>
I don't think that changes anything, that just adds a case of direct liveness observation.
02:29
<bakkot>

That was mostly in re the

WeakMap with Array<{ ref: WeakRef<AbortSignal>, callbacks: AbortAlgorithmList }>

bit; if there are any event listeners in the callbacks then you can't get away with a WeakRef because the signal needs to be alive at the time the event listeners are invoked

02:29
<Mathieu Hofman>
Trying to dig into the requirements, it seems like a simple "make sure my dependent callbacks are called, even if the signal itself goes out of scope". It doesn't strictly require that the signal object itself be retained, just that its internal "aborted + callbacks state" survives it
02:31
<bakkot>
The signal itself does need to be retained if any of the callbacks are event listeners, because the event listeners can observe the signal. But that's right in the absence of event listeners, I think.
02:32
<Mathieu Hofman>
right, the event stuff creates a liveness barrier on its own. well technically if the event handler doesn't look at the event target the engine is free to collected the signal there too
02:33
<Mathieu Hofman>
anyway, while Richard's suggestion isn't quite right, that's definitely the kind of stuff that can be written in userland with a combination of WeakRef/FinalizationRegistry and WeakMap.
02:35
<Mathieu Hofman>
And the DOM GC constraint is a little too prescriptive for what it's trying to accomplish
02:38
<Richard Gibson>
the requirement for event listeners is just strong references in those records corresponding with use of that machinery
02:41
<bakkot>
How do you know when there is "use of that machinery" in userland? EventTarget.prototype.addEventListener.call(yourThing) does not give you anything you can hook
02:47
<Richard Gibson>
that's just saying that EventTarget integration cannot be perfectly polyfilled, which seems like an issue independent of AbortSignal
02:51
<bakkot>
The reason I brought up GC is to justify why I think AbortSignal.any needs to be be in the language. I guess it's true that we could leave it out and accept that you could do something complicated with WeakRefs and so on, as long as your platform also doesn't have EventListener? But I don't know why we would want to do that.
02:51
<bakkot>
What is the thing you are asking for here?
02:52
<Richard Gibson>
oh, I've been speaking from a specifier point of view. I agree that AbortSignal.any belongs.
02:53
<Mathieu Hofman>
I'm wondering if the steps as currently specified in the PR, without any GC requirement are not sufficient. The spec does iterate the callbacks associated with a dependent signal, using an internal reference from the source signal to the dependent signal. It would be quite unreasonable to consider that lookup as "weak" such that the callbacks are not executed if the signal is not reachable by user code. On the flip side, this lookup does not cause the dependent signal object itself to be observed by user code, and especially if the signal has been marked as aborted / all callback are empty. To make it more obvious the dependent signal can be collected, I think it should be possibly to "remove" a dependent signal from all its SourceSignals's DependentSignals lists when running its abort steps.
02:55
<bakkot>
The spec doesn't say anything about any of this except "make sure GC doesn't observably prevent any abort callbacks or event listeners from running" basically. Do you want it to say something else?
02:55
<Richard Gibson>
no, that's good for me
02:57
<Mathieu Hofman>

FYI my comment was about the over prescriptive requirement from DOM that the signal itself remains uncollected, and the following sentence in a note of the PR which reads like a requirement, but should probably be worded as a clarification of what is actually permitted:

If a signal can still be aborted, the implementation must preserve every observable effect of that abort

02:57
<bakkot>
Yeah we could do that I think. IIRC some people have objected to adding steps that are unobservable just as a hint to engines but I personally am happy to give hints to engines (technically the draft spec already has an instance of such a thing in the entry.[[Algorithm]] to empty, though it's very minor)
02:58
<bakkot>

a note of the PR which reads like a requirement, but should probably be worded as a clarification of what is actually permitted

Well, it is in a NOTE, which is definitionally only a clarification. but I can try tweak the wording to make that clearer certainly.

02:58
<Mathieu Hofman>
aka "must" in a note is a smell
03:00
<bakkot>
not entirely sure how to word a note that is explaining an existing requirement without saying "must", but I'll see what I can come up with
03:00
<Mathieu Hofman>
Yeah we kinda need "note steps" for these. An actual implementation will want to do it, but it's unobservable whether they do
03:01
<bakkot>
Most actual implementations are probably going to just continue use the DOM algorithm and ignore all this stuff
03:01
<Mathieu Hofman>
stating it as a fact? "aborting one of its sources must still invoke that callback" -> "aborting one of its sources still invokes that callback"
03:03
<bakkot>
sgtm, will push in a sec
03:13
<bakkot>
pushed
03:28
<bakkot>
also did this: https://github.com/tc39/proposal-cancellation/pull/35/changes/5eaa281df97ef18c398057785725e6c5cfadfe17
03:28
<bakkot>
(in both directions, since we might as well)
14:32
<James M Snell>
Just want to confirm what time we're starting today. (given the scheduling snafu yesterday)
15:13
<Chris de Almeida>
16:00 UTC
15:15
<Chris de Almeida>
btw, whoever suggested that we post times in UTC to avoid what happened, that would not have helped. we originally had it for one timezone and then later switched the timezone. we forgot to update it on the agenda itself, and then the agenda time got copied to the Reflector post. if we had the UTC on there, it would have been the same problem -- one place would have said 16:00 and the other two would have had 15:00
16:07
<Caio Lima>
Isn't Annex-B part of spec that new non-web implementations might choose not to implement? If so, keeping it legacy and removing form Annex-B would force new implementations to implement that to be spec compliant, but also recommend to not support its use. So why implement it in the first place? May this was the motivation to place on Annex-B (just a guess, I don't have history).
16:08
<Michael Ficarra>
seriously, who uses either substr or substring? slice always
16:10
<nicolo-ribaudo>
Counter-proposal: move substring to Annex B
16:10
<Chris de Almeida>
wow... looking at my own code in our largest project, I am using mostly slice, substr, and substring .. in that order
16:11
<Chris de Almeida>
although the last two only amount to a handful of instances
16:15
<Michael Ficarra>
@Justin Ridgewell RTL languages, whose start is not on the left and whose end is not on the right
16:19
<nicolo-ribaudo>
I was half-jocking but now that I'm looking into what it does it actually seems like something we should do
16:19
<Michael Ficarra>
personally, I don't think we've made any progress unless we move it into the main body without a legacy marker
16:22
<Justin Ridgewell>
I do agree substr is an absolutely awful name due to substring
16:22
<Justin Ridgewell>
It is confusing, but it is also used in the wild.
16:24
<Richard Gibson>
if we need to conserve legacy status for one of the three, substring is the best candidate
16:26
<nicolo-ribaudo>
ljharb: .substr takes the length; .slice takes the end. It's not the same API shape.
16:26
<nicolo-ribaudo>
It's .substring that kind of has the same API shape as .slice, except for how it does clamping
16:27
<Chris de Almeida>
we should have known 30 mins would be insufficient for this topic 😄
16:27
<Michael Ficarra>
seriously, anything Annex B related needs more than that
16:27
<nicolo-ribaudo>
Omitting semicolons is not legacy!
16:28
<ljharb>
it should be though
16:28
<nicolo-ribaudo>
I would be happy to provide my +1 if you present it :P
16:28
<Michael Ficarra>
unfortunately, we are only like 80-20 in agreement with that somehow
16:29
<ljharb>
lol we already tried, and then Brendan took back his support
16:33
<ljharb>
tbc anything in annex B already has normative optional and legacy and can be editorially inclined in the spec if it retains those labels. Consensus is only required to remove one of those labels.
16:35
<jmdyck>
s/inclined/inlined/ ?
16:37
<Michael Ficarra>
to be clear about the difference here, we were making it clear that json/text modules without a type attribute are okay, but a JSON module with type: "text" and a text module with type: "json" are not okay
16:37
<Michael Ficarra>
which is what we think the intent was, but it wasn't exactly what the text said when it was agreed to for 2.7/3
16:38
<Michael Ficarra>
so we wanted to make sure nobody objected to that
16:38
<nicolo-ribaudo>
And this was just a clarification in the note for something already reuqired by the normative text right above
16:39
<nicolo-ribaudo>
This is the normative text that the note refers to
16:56
<Ashley Claymore>
guybedford: btw, agenda needs link to slides
16:57
<eemeli>
Michael Ficarra: I've updated the .substr PR: https://github.com/tc39/ecma262/pull/4087
17:00
<Michael Ficarra>
okay, so my understanding is "there's a lot of code that uses this, both web and non-web" is the motivation for making it non-optional, which requires moving it out of Annex B, but we still think it's gross and shouldn't be used by new code so we're going to continue marking it as legacy
17:00
<Michael Ficarra>
is that also your understanding, @eemeli?
17:01
<Michael Ficarra>
the consequence of that would be that your editor still yells at you for doing it, which was one of your points of motivation
17:01
<eemeli>
That's my understanding of what we can agree on. I personally would prefer it not to be considered legacy either, but I don't believe that's an opinion the committee is likely to reach.
17:02
<Chris de Almeida>
"we still think it's gross" is really "we couldn't all agree that it wasn't gross"
17:02
<eemeli>
Of the three functions, I think .substring is the one that ought to be left out, if any.
17:03
<eemeli>
Yes, but it's pretty clear that there's sufficient opposition to make asking for it to be non-legacy to not be successful, so I'm happy to improve things at least a little bit.
17:03
<Michael Ficarra>
We don't get to write that in the spec. We have a consensus opinion and the consensus atm is that it's gross.
17:04
<Chris de Almeida>
I ... do not disagree
17:04
<Michael Ficarra>
personally, I would mark both substring and substr as legacy, there's no reason not to use slice
17:04
<eemeli>
I don't think we have a consensus for it being gross. We have a state of affairs that predates pretty much all of us.
17:04
<Chris de Almeida>
I would support you
17:05
<eemeli>
well, I had not considered that.
17:05
<Michael Ficarra>
we also have committee consensus for PTCs 😉
17:05
<eemeli>
I'd be fine also marking .susbtring as legacy.
17:08
<eemeli>

The further change to the PR would be


--- i/spec.html
+++ w/spec.html
@@ -36701,3 +36701,3 @@ THH:mm:ss.sss

-      <emu-clause id="sec-string.prototype.substring" type="built-in function">
+      <emu-clause id="sec-string.prototype.substring" type="built-in function" legacy>
         <h1>String.prototype.substring ( _start_, _end_ )</h1>
17:08
<nicolo-ribaudo>
Was waldemar's comment about value judgement only about substr vs substring, also also vs slice?
17:09
<eemeli>
Tbh, having both .substr and .substring as legacy would be clearer, as we do have .slice.
17:10
<Michael Ficarra>
I was on the queue to ask for that clarification, but we ran out of time 😞
17:10
<eemeli>
Does this rub anyone up the wrong way? Should we actually consider this?
17:11
<Richard Gibson>
immutable ArrayBuffer web integration start point: https://github.com/tc39/proposal-immutable-arraybuffer/issues/43
17:13
<Chris de Almeida>
see also: Decorators
17:14
<bakkot>
wasn't gonna say it
17:15
<dminor>
We already have an implementation in SpiderMonkey, but it's not shippable if the web integration isn't done
17:15
<James M Snell>
fwiw, I never said anything about forcing them to do anything. I'd want us to see about fixing the process on both sides so that things don't get blocked through inaction.
17:17
<Chris de Almeida>
I'm not sure how we can fix that via our processes, but I will keep an open mind
17:40
<Michael Ficarra>
I'm confused, is that Apple's position or just Anne's?
17:43
<Ashley Claymore>
pre-point of order. I'll need to drop in a min and stop note taking. Planning on getting train over the break
17:45
<peetk>
i gotchu
17:49
<nicolo-ribaudo>
keith_miller this shows that most code that reads .code uses strings: https://github.com/search?q=%22.code+%3D%3D%3D%22+language%3AJavaScript&type=code&p=1
19:00
<Olivier Flückiger>
Hmm, does zoom want a passcode for anybody else?
19:00
<Chris de Almeida>
on the web yes
19:01
<Olivier Flückiger>
ok, can we change that? I can't join...
19:01
<nicolo-ribaudo>
It should be encoded in the URL. Use the original URL rather than reloading
19:02
<nicolo-ribaudo>
The one from the form
19:02
<Chris de Almeida>
the form will give the code as well but I will DM
19:02
<Olivier Flückiger>
ok, weird. it worked the last two times when I reloaded the page
19:03
<Olivier Flückiger>
and then suddenly stopped
19:03
<Olivier Flückiger>
all good thanks
19:03
<Olivier Flückiger>
I am now registered twice I guess :)
19:03
<chipmorningstar>
You must be beside yourself with that.
19:06
<Mathieu Hofman>
My trick is to go back to the history and find the "Google redirect" page the form sends you to first. That has the full link that can be reused
19:07
<Olivier Flückiger>
Just need to make sure my identity is not observable.
19:12
<nicolo-ribaudo>
I feel like we might want to do a temp check
19:13
<Michael Ficarra>
💯 Nicolò, people who are looking for this are searching for fma
19:14
<Justin Ridgewell>
Isn't product sum a Matrix function?
19:15
<nicolo-ribaudo>
A number is just a very tiny matrix
19:17
<Michael Ficarra>
also, the proposed name for WebAssembly (not final) is fma: https://github.com/WebAssembly/relaxed-simd/issues/27
19:18
<nicolo-ribaudo>
Wow really nice temp checks with proper labels
19:18
<bakkot>
I agree that it's not used much but in the places it is used it can be used a lot
19:19
<bakkot>
especially since we're not providing a vectorized version
19:32
<Michael Ficarra>
"not as fast as something that is unfit for purpose" is not a demerit
19:33
<Michael Ficarra>
why would we be comparing perf against JSON.stringify other than for curiosity?
19:35
<Richard Gibson>
JSON.stringify often is functionally correct, given relevant application-specific constraints. The speed comparison matters.
19:37
<Michael Ficarra>
then compare against a version of Composites that is just as functionally correct, which will be more favourable for Composites
19:39
<Michael Ficarra>
comparing against json-stable-stringify would be ~fair
19:39
<mgaudet>
We're getting perilously close to revisiting value types. Which... I personally am not uninterested in but there's a long history of (personal blog post in drafting...)
20:08
<Michael Ficarra>
it's JavaScript, everything's full of cliffs
THANK YOU! YES!
20:09
<Michael Ficarra>
we're being so weird about perf here
20:23
<Richard Gibson>
did something just change with transcription? It's suddenly very heavy on em-dashes
20:24
<bakkot>
no but it's probably kind of an LLM and therefore tends to keep doing anything that it has just started doing
20:24
<bakkot>
I think they're actually an improvement over having all the same words but without emdashes for stutters, which is what it was before
20:25
<bakkot>
(well, maybe)
20:25
<Richard Gibson>
I agree, it's still flawed but overall better
20:25
<Richard Gibson>
just weird that we got into this mode mid-stream
20:25
<nicolo-ribaudo>
It varies a lot by speaker
20:26
<nicolo-ribaudo>
But yeah both Ashley and James are full of dashes
20:30
<Michael Ficarra>
I feel like the transcription has been worse this meeting than in the recent couple of meetings
20:30
<Michael Ficarra>
especially for non-native speakers
20:32
<ljharb>
i would fully support marking that legacy, ftr, it also sucks
20:33
<bakkot>
hm, there is a new STT model from the provider, but it claims it's not supposed to automatically switch over until December 15
20:33
<bakkot>
so it should be the same as at least the last two meetings
20:34
<bakkot>
I could explicitly switch it over to the new model to see if it's better tomorrow, if we think it's worth running the experiment
20:37
<Michael Ficarra>
oh my, em dashes everywhere!
20:38
<Michael Ficarra>
okay, it was not like this yesterday or even this morning, what is going on?
20:38
<waldemar>
— — — — — — —
20:38
<bakkot>
oh, the other problem here is that I have a regex that replaces like the the and it's not triggering when there's emdashes, I can probably fix that specific thing
20:39
<waldemar>
Transcription AIs are evolving very quickly now.
20:40
<Richard Gibson>
it literally happened inside a single agenda topic
20:41
<bakkot>
ok I cannot fix it because the fscking remote desktop software is too garbage, sorry
20:41
<mgaudet>
Wow. I'll try helping to clean up a bit too
20:43
<rbuckton>
It's technically feasible to support userland generators via a wrapper, i.e. new Iterator.Transferable(myIterator), which would delegate next/return/throw until .transfer() is invoked.
20:47
<Michael Ficarra>
lol yeah might as well put it on Object.prototype, it's just as unenforceable
20:48
<rbuckton>
Or, if only built-in iterators supported it, you could just do Iterator.from(myIter) to gain support.
20:51
<Michael Ficarra>
again, that's the author opting in
20:51
<Michael Ficarra>
there's a thousand ways we could allow the author to opt in
20:52
<rbuckton>
Yeah. The only way I think this could work for user-defined iterators is to opt-in.
20:52
<Richard Gibson>
I see HE Shi-Jun on the queue... is that Hax (JHX)?
20:55
<Mathieu Hofman>
Only if you trust that no-one kept the myIterator or whatever custom data backing it has
20:57
<ljharb>
btw, i wasn't here during the CoC update, but regarding the discourse, i've started autoblocking link patterns that the spammers are using. thanks to everyone who's been flagging posts as spam as well, that helps
20:57
<Mathieu Hofman>
It's all variations of "I pinky swear no one else has agency over the data being iterated"
20:59
<Michael Ficarra>
@Mathieu Hofman to me, it necessarily requires author opt-in, in which case the author can just use typical encapsulation mechanisms to achieve this goal
20:59
<Michael Ficarra>
a transfer on Iterator.prototype doesn't help that
21:02
<Olivier Flückiger>
I am not sure if we did the proposal any good by advancing it in the current state with a half open queue. I am pretty sure anything that involves invalidating iterator state post-hoc will be blocked by implementers at stage 2. Detaching array buffers is such a nightmare to implement, I do not wanna repeat it.
21:02
<Mathieu Hofman>
Right, you basically have to trust/known the source implements transfer, and be able to request the transfer from the source through a trusted channel to the source. The AB equivalent is that user code knows by spec AB implements transfer truthfully (by invalidating/detaching other instances), and I can request the transfer through a trusted ArrayBuffer.prototype.transfer()
21:03
<Chris de Almeida>
forwarding you an email. I have no idea if it's genuine (e.g. they aren't themselves a spammer) but they did go through the trouble to write that email
21:03
<Mathieu Hofman>
All that works because AB encapsulates the backing buffer
21:04
<Olivier Flückiger>
Yeah, 10 spec bugs and 100 implementation bugs later it mostly does
21:05
<Michael Ficarra>
welp, I look forward to the Stage 2 presentation if that day ever comes
21:06
<Michael Ficarra>
I will either be very impressed or very smug
21:07
<iain>
Another point to note is that ArrayBuffer transfer, while complicated, happens in one place, while it seems likely that each builtin iterator will require its own work to support transfer.
21:07
<iain>
("happens in one place" overstates it, but you get what I mean)
21:12
<Mathieu Hofman>

My anticipation is:

  • each "class" that wants to support transfer semantics needs to implement it itself, with ad-hoc usage. There is nothing the language itself provides to help with this.
  • we come up with some generic move solution, that relevant language and platform objects implement, and that somehow can be opted-in by user defined types (possibly based on some transfer/invalidation of private fields?)
21:17
<Mathieu Hofman>
But even for the latter one, as the consumer you'd still want to identify the class implementing transfer semantics, so I really don't see how it's fundamentally different than the former.
21:21
<James M Snell>
I think for intrinsic iterables it's pretty straightforward. For user-implemented ones, the best approach I can see is that it would, at best, be a cooperative protocol... but the iterable protocol already is cooperative so maybe that's fine.
21:22
<Mathieu Hofman>
iterables or iterators ?
21:22
<James M Snell>
iterables, sorry
21:22
<James M Snell>
maybe iterators... sorry, distracted doing three things at once. The iterator itself is what is transfered (the object with next(), return(), etc)
21:25
<Mathieu Hofman>
the iterator is a step removed from the iterable source. I'm worried, asking the iterator unless you involve the source (or some trusted iterator base) is not going to give proper assurances
21:25
<Mathieu Hofman>
at the end of the day, any polymorphic dispatch to the object cannot be trusted to perform an actual transfer
21:27
<James M Snell>
the iterator protocol is already cooperative. next(), return(), even Symbol.iterator, already have similar lack of assurances. Maybe "transfer" is just the wrong name as it implies an assurance of exclusivity. Maybe there's a better name?
21:28
<Mathieu Hofman>
Aka you can trust TrustedThing.transfer(foo) if TrustedThing guarantees it recognizes foo and can perform genuine transfer operations on it.
21:28
<Mathieu Hofman>
Then it's as I implied, mostly a documentation step?
21:30
<James M Snell>
that or... it's an extension of the iterable protocol
21:35
<James M Snell>

that is... add transfer() (or move()) to table 80... "may also implement"....

`"transfer" (or "move") .. a function that returns an iterator object ... the returned object must conform to the iterator object interface. invoking this method notifies the iterator object that the caller wishes to take ownership of the iterator's state..." ... only as much a guarantee as the existing protocol provides

21:39
<Mathieu Hofman>
yeah I'm just worried consumers would take this as face value and assume they really have full ownership
21:40
<bakkot>
yeah I don't really see how "it's an error to pass this something that doesn't correctly implement the transfer method" is much of an improvement over "it's an error to pass this something and then continue consuming it elsewhere"
21:52
<James M Snell>

I think the difference comes down to who owns the burden. In the current code:

function* gen() { yield 1; yield 2; }
const g = gen();
const rs = ReadableStream.from(g);

The burden for doing the right thing falls on whomever holds a reference to g.

Under the proposal...

const g = gen();
const rs = ReadableStream.from(g.transfer());

The burden falls on the implementation of ReadableStream.from() and whomever implemented the iterator to do the right thing.

as someone who is more on the side of the implementor of ReadableStream.from() and the iterator, I'd prefer the burden to fall on me than whomever is using it.

But by itself, I admit that's not super strong