4 ms·
So which language have a great structured concurrency implementation? I can only think of C++20 and of Kotlin
by The_rationalist 6y ago
So which language have a great structured concurrency implementation?
I can only think of C++20 and of Kotlin
- toolslive 6y agoOcaml's Lwt lets you set this up quite easily.
- mping 6y agoJava's upcoming project loom supports structured concurrency [1]. I gave it a shot and it works great. [1] https://wiki.openjdk.java.net/display/loom/Structured+Concurrency https://wiki.openjdk.java.net/display/loom/Structured+Concur...
- MisterTea 6y agoOld concept but Plan 9 c and thread(2) is simple yet really nice to work with. Also helps that there is no posix junk and plan 9 threads are light weight processes with shared memory. So libthread lets you spawn and manage processes or threads and groups them in rendezvous groups to guarantee sequential thread execution. That can eliminate the need for locks since no two threads in a rendez group will be running at the same time. Then use channels to read/write messages between procs. Way better pattern than async/await nonsense. http://man.postnix.pw/9front/2/thread http://man.postnix.pw/9front/2/thread example code (random 9 mirror I picked): https://github.com/mischief/9problems/blob/master/sys/src/libthread/example.c https://github.com/mischief/9problems/blob/master/sys/src/li...
- valenterry 6y agoHaskell and Scala are top notch in this area. Probably one of their biggest advantages. I always feel a bit sad when I see that other programming languages try to solve the same problem and come up with an inferior solution that they then try improve by fixing edge cases. I wish programming language authors would learn more from each other.
- Jtsummers 6y agoAda's tasks are interesting from this perspective. There's more on it here (I had trouble finding good online tutorials/examples, this one is part of a larger set of Ada learning materials): https://learn.adacore.com/courses/Ada_For_The_CPP_Java_Developer/chapters/11_Concurrency.html https://learn.adacore.com/courses/Ada_For_The_CPP_Java_Devel...