Earlier quoted context omitted.
Browsers have said that they are unwilling to ship any new cancelation mechanisms given that AbortSignal already exists, so we can't ship a different CancelToken. But I think there's a path to standardizing a subset of the existing AbortSignal machinery [1]. (I am on TC39 and while this isn't my highest priority I did bring the topic for discussion at the last meeting [2], and there was support from the rest of commi…
Yes, I was around during the original discussions. AbortSignal exists because TC39 was taking too long and cancelling fetch() is table stakes for a networking oriented platform like the web. Those threads are a good example of what's wrong in TC39. A simple AbortSignal could have been added, but by the time it's reconciled with SES, large speculative APIs like Governers, or the original attempt to add a parallel thro…
You can't cancel a JavaScript promise (except sometimes you can)
61–66 of 66 posts
Re: You can't cancel a JavaScript promise (except sometimes you can)
#62Re: You can't cancel a JavaScript promise (except sometimes you can)
#63I like how C# handles this. You're not forced to support cancellation, but it's strongly encouraged. The APIs all take a CancellationToken, which is driven by a CancellationTokenSource from the ultimate caller. This can then either be manually checked, or when you call a library API it will notice and throw an OperationCancelledException. Edit: note that there is a "wrong" way to do this as well. The Java thread libr…
Before the removal of the GIL in recent years, Python seemed well-positioned to leverage the GIL to offer safe thread-cancellation points that didn’t leave interpreter internals in a corrupted state.
That’s not necessarily an endorsement of the idea of Thread.stop in many cases, since stopped user code can cause broken assumptions at a high level no matter what, but it has its uses. Erlang’s exit/2 is proof of that, though it is a very sharp and rarely-appropriate tool.
Re: You can't cancel a JavaScript promise (except sometimes you can)
#64I like how C# handles this. You're not forced to support cancellation, but it's strongly encouraged. The APIs all take a CancellationToken, which is driven by a CancellationTokenSource from the ultimate caller. This can then either be manually checked, or when you call a library API it will notice and throw an OperationCancelledException. Edit: note that there is a "wrong" way to do this as well. The Java thread libr…
I really hope that coroutines land in Rust after being experimental to improve the async stuff.
The C# Tasks are not bad but I think the API could be easier and more precise/clear.
Re: You can't cancel a JavaScript promise (except sometimes you can)
#65Earlier quoted context omitted.
Mh, I couldn't read due to the huge contrast and had to switch to reader mode, so...
What colors were you seeing? It's light white text on a black background for me-- both super common and plenty readable.
Re: You can't cancel a JavaScript promise (except sometimes you can)
#66Earlier quoted context omitted.
Mh, I couldn't read due to the huge contrast and had to switch to reader mode, so...
I personally find it to be perfectly readable. I've heard of people with issues with white text on a black background, but I don't fully understand it. Do you have astigmatism?