4 ms·
FP libraries have pretty much solved this IMO. You create a value that describes what you want to happen and that description can include cancellation if some c
by noelwelsh 7y ago
FP libraries have pretty much solved this IMO. You create a value that describes what you want to happen and that description can include cancellation if some condition is met (e.g. it takes too long). There are limitations imposed by the runtime on what you can actually cancel (e.g. I don't believe all OS calls can be interrupted) but beyond that it works as specified.
Here's one example of such a library, though without a bit of FP background it probably doesn't make a great deal of sense:
https://typelevel.org/cats-effect/typeclasses/concurrent.html https://typelevel.org/cats-effect/typeclasses/concurrent.htm...
- marcosdumay 7y agoI dunno. As bad as Haskell's exceptions are, I still didn't see anything better. On a sane system, every little thing must be cancellable, otherwise nothing really is. This interface fails because of this.
- noelwelsh 7y agoI'm not sure what the situation is on Haskell. In Scala there are at least 3 such libraries. I feel your objection is making the great the enemy of the good. These libraries are vastly better than the default way of working in imperative languages (I know from experience with both!) and we should try to make the innovations more widely known rather than nitpicking.