Off topic, but that site has really nice design
You can't cancel a JavaScript promise (except sometimes you can)
11–20 of 66 posts
Re: You can't cancel a JavaScript promise (except sometimes you can)
#12> Libraries like Effect have increased the popularity of generators, but it's still an unusual syntax for the vast majority of JavaScript developers. I'm getting so tired of hearing this. I loved the article and it's interesting stuff, but how many more decades until people accept generators as a primitive?? used to hear the same thing about trailing commas, destructuring, classes (instead of iife), and so many more.…
I don't really see generators ever crossing into mainstream usage in the same way as the other features you've compared them to. Most times... you just don't need them. The other language tools solve the problem in a more widely accessible manner.
In the (very limited & niche) subset of spots you do actually need a generator, they're nice to have, but it's mostly a "library author" tool, and even in that scope it's usage just isn't warranted all that often.
Re: You can't cancel a JavaScript promise (except sometimes you can)
#13Off topic, but that site has really nice design
Mh, I couldn't read due to the huge contrast and had to switch to reader mode, so...
Re: You can't cancel a JavaScript promise (except sometimes you can)
#14I 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…
Re: You can't cancel a JavaScript promise (except sometimes you can)
#15Re: You can't cancel a JavaScript promise (except sometimes you can)
#16I 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…
AbortSignal is same thing on the Web. It's unfortunate TC39 failed to ever bring a CancelToken to the language to standardize the pattern outside browsers.
Re: You can't cancel a JavaScript promise (except sometimes you can)
#17Re: You can't cancel a JavaScript promise (except sometimes you can)
#18I 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…
It's hard to miss all the warnings unless you're literally just looking at the method name and nothing else.
Re: You can't cancel a JavaScript promise (except sometimes you can)
#19I 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 am surprised that you had to go out of your way to remove Thread.stop from existing Java code. It's been deprecated since 1998, and the javadoc page explains pretty clearly why it's inherently unsafe. It's hard to miss all the warnings unless you're literally just looking at the method name and nothing else.