00:30
<Justin Ridgewell>
Oh god, I finally have a real use for Symbol.species: to simulate async contexts.
19:42
<Justin Ridgewell>
Nope, don't need species at all, just need to patch Promise.prototype.then and you get all the benefits.
19:48
<bakkot>
Justin Ridgewell: even given that await on a native promise will bypass Promise.prototype.then?
19:49
<Justin Ridgewell>
It's not possible to properly hijack await with species either
19:49
<Justin Ridgewell>
You have to manually restore after the await is over.
19:49
<bakkot>
true, true
19:49
<bakkot>
well
19:50
<bakkot>
you could replace Promise.prototype.constructor with something other than Promise, and then await would always fall back to the slow path where it calls the actual .then
19:50
<bakkot>
please do not do this though
19:50
<bakkot>
especially given that you're thinking of changing how the fast-path in await works
19:51
<Justin Ridgewell>
I believe the await will still resume 1 tick after settling the patched promise?
19:51
<bakkot>
depends on what your implementation of .then does
19:51
<bakkot>
it could just call the continuation synchronously, if you wanted
19:51
<bakkot>
though, again, don't
19:52
<bakkot>
oh, wait, no, that's a lie
19:52
<bakkot>
it will always take at least 1 tick, yes
19:52
<Justin Ridgewell>
Yah, you consume the userland promise into a native, then chain on the native, which must wait 1 tick.
20:16
<snek>
bring back the async context proposal
20:44
<Justin Ridgewell>
Might need to
20:44
<Justin Ridgewell>
We could do it in a way that's not so magic.
23:44
<bakkot>
oh hey, github fixed their previews for large documents like spec.html!
23:44
<bakkot>
you can actually expand context in the pr preview now, instead of those buttons silently failing