01:23
<babaca>
https://skidson.online/ Best AQW Private server AQW Is a free to play browser mmorpg you can play with your friends join us now! Join our discord below: https://discord.gg/ZAebPzpsbR
01:48
<Jack Works>
https://es.discourse.group/t/cooperative-async-function/975
01:48
<Jack Works>
Anyone interested in this?
02:57
<ljharb>
I’m not sure i understand it. JS doesn’t have coroutines; and it doesn’t seem like you’re proposing a task runner be added for them
02:58
<ljharb>
also i don’t think “typescript has trouble typing x” is an argument for any proposal
03:14
<Jack Works>
I’m not sure i understand it. JS doesn’t have coroutines; and it doesn’t seem like you’re proposing a task runner be added for them
host or userland code can do them
03:14
<Jack Works>
also i don’t think “typescript has trouble typing x” is an argument for any proposal
ok i'll remove this line
03:16
<Jack Works>
I’m not sure i understand it. JS doesn’t have coroutines; and it doesn’t seem like you’re proposing a task runner be added for them
generator are the native cooperative way of scheduling multiple tasks, I'm just proposing a syntax sugar of it
03:17
<ljharb>
it doesn’t feel like the natural way to me
03:18
<ljharb>
i love the idea of a Task primitive, that produces a promise but isn’t itself one, but i don’t think generators are the ideal or natural fit for that (even async ones, altho that’s at least a much smaller gap)
03:18
<Jack Works>
it just don't have the good keywords for this task
03:20
<ljharb>
The language definitely doesn’t solve this problem well. “scheduling” seems odd to me tho since the language doesn’t have any timers in it
03:20
<Jack Works>
yeah, I don't intended to add a scheduler.
03:21
<Jack Works>
WICG scheduler is a perfect companion for this kind of Task
03:21
<ljharb>
i like that a task could be started, stopped, cancelled, restarted, etc. generators don’t map well to that tho, because generators aren’t reusable and can’t be resumed once they’re interrupted (like return/throw/done, vs yield)
03:23
<Jack Works>
My idea above support started, pause and cancel and those 3 cases can be supported by generators well. I didn't think restart is very necessary when I was thinking of that abstraction.
03:27
<Jack Works>
for example, react break their heavy tasks (diff or something like that) into pieces and do only a little things in every 16ms (maybe?)
03:31
<Jack Works>
scheduler.postTask(function* () {
    const result = yield* diffTree(oldJSX, newJSX)
}())

If the WICG scheduler supports generator, it can pause the calculation of diffTree anytime to make the web page keep responding

03:59
<ljharb>
how is that different from a setTimeout or setInterval or rAF?
03:59
<Jack Works>
you can do as much work as possible if there is enough time
04:40
<bakkot>
Jack Works: are you familiar with isInputPending? I feel like that already gives you the thing you need basically
04:42
<bakkot>
for the "do as much work as possible if there is enough time" part, at any rate
15:53
<devsnek>
future style doesn't make much sense to me in js tbh, as much as i like it
15:53
<devsnek>
in a language like rust, you're combining various raw io surfaces, communicating across threads, etc
15:54
<devsnek>
but in js, everything you communicate with already exists within the agent and its scheduling
23:39
<rkirsling>
wow that repo had so many open issues
23:39
<rkirsling>
my inbox is ablaze
23:53
<TabAtkins>
Indeed, sorry about that.
23:54
<TabAtkins>
All done now.