zlacker

[return to "Rama on Clojure's terms, and the magic of continuation-passing style"]
1. moomin+eD[view] [source] 2024-10-14 10:17:59
>>nathan+(OP)
I feel like CPS is one of those tar pits smart developers fall into. It’s just a fundamentally unfriendly API, like mutexes. We saw this with node as well: eventually the language designers just sighed and added promises.

You’re better off with an asynchronous result stream, which is equivalent in power but much easier to reason about. C#’s got IAsyncEnumerable, I know that Rust is working on designing something similar. Even then, it can be hard to analyse the behaviour of multiple levels of asynchronous streams and passing pieces of information from the top level to the bottom level like a tag is a pain in the neck.

◧◩
2. neonsu+Xm1[view] [source] 2024-10-14 16:10:55
>>moomin+eD
I found myself liking the F# way of consuming/producing IAsyncEnumerable's with taskseq. It's very terse and looks nice: https://github.com/fsprojects/FSharp.Control.TaskSeq?tab=rea...
◧◩◪
3. moomin+Wr1[view] [source] 2024-10-14 16:40:32
>>neonsu+Xm1
Apparently Microsoft hold a patent on “yield!”, which makes it all the more frustrating that they haven’t included it in C#.
◧◩◪◨
4. neonsu+Ey1[view] [source] 2024-10-14 17:18:25
>>moomin+Wr1
In F#, yield! is a computation expression, C#'s yield within methods that return IAsyncEnumerable<T> works more or less the same way.
[go to top]