03:33
<snek>

returns an implementation defined value implementation defined Completion Record

which means for (const a of b) { eval("debugger") } might be able to break the for loop?

function calls are not allowed to return break or continue completions
03:34
<snek>
if someone cares we should add the same restriction to debugger
03:34
<snek>
or just remove the return entirely
03:36
<snek>
actually I wonder.... direct eval may not have that assert cuz it forks evaluatecall
03:36
<snek>
this is so niche lol
10:05
<Jack Works>
function calls are not allowed to return break or continue completions
Oh then for (x in b) debugger 😂
19:38
<Kris Kowal>
I’m looking forward to the proposal that adds forAwaitEach to the iterator and async iterator prototypes.
19:45
<Kris Kowal>
I’m looking forward to the proposal that adds forAwaitEach to the iterator and async iterator prototypes.
Such that it returns a promise for the final value https://github.com/tc39/proposal-iterator-helpers/issues/217
19:50
<bakkot>
hmm, really the async forEach should be returning a promise already
19:50
<bakkot>
so you can tell if it's done / catch errors
19:50
<Kris Kowal>
Yes
19:51
<bakkot>
I am less sold on the return value, mostly because I've never encountered a compelling use case
19:52
<Kris Kowal>
Came up because a member of Agoric’s dev community needed the final value from one of our async iterators https://github.com/Agoric/agoric-sdk/discussions/5924#discussioncomment-3378600
19:53
<Kris Kowal>
In this case, the final iteration value is a timestamp that marks the time the sequence stopped.
23:43
<snek>
hmm, really the async forEach should be returning a promise already
was this not already the case?
23:53
<Kris Kowal>
I can imagine there being a concern if AsyncIterator.prototype.forEach returns a promise where folks expect forEach generally to not return a promise. A pretty easy solution to that would be to have Iterator.prototype.forEach, Iterator.prototype.forAwaitEach, and AsyncIterator.prototype.forAwaitEach, but no AsyncIterator.prototype.forEach.
23:54
<Kris Kowal>
Where forEach returns the final value and forAwaitEach returns a promise for the final value.