3 ms·
I find this concept really remarkable and extraordinary. When I first encountered it I was still programming in Java and to my surprise there is an implementati
by fogetti 8y ago
I find this concept really remarkable and extraordinary. When I first encountered it I was still programming in Java and to my surprise there is an implementation of it in Java, see:
https://en.wikipedia.org/wiki/JCSP https://en.wikipedia.org/wiki/JCSP
I really enjoyed playing with this library. Somehow the basic abstractions and the mental model to use it felt much easier in general than the threading model. It reminded me of go channels for some extent. It is also a very powerful concept. It even allows to emulate the actor model. Sadly it is not actively developed any more.
- jerf 8y ago"It reminded me of go channels for some extent." Go channels explicitly drew from CSP for inspiration, but it is not exactly the CSP in the paper. That said, almost everything that draws from CSP for inspiration has at least a small difference from the paper, if you analyze it closely enough. Often major differences. The idea seems robust enough to those variations that it's not a problem, though.
- zzzcpan 8y agoHow is it robust if Go is pretty much the only widely used CSP implementation in existence. And Go itself is constantly fighting CSP deficiencies, trying to abstract it away and move closer to actors. Still not getting there, because actors cannot be properly implemented on top of CSP and CSP alone cannot be used for anything real world related. If anyone wants to learn something from CSP, learn why it doesn't work.
- AnimalMuppet 8y agoCould you be a bit more specific? Why do you think it doesn't work? Why do you think actors are better? And why can't actors be properly implemented on top of CSP?
- Zalastax 8y agoI touched on this in my MSc thesis [1], see section 2.6 and 3.4.1. The original CSP can only work if you stay on a single machine. You can have channels in a distributed setting but you need to make the reading capability of a channel limited to a single consumer. If there are multiple possible readers at the same time it gets impossible to know where to send each message and in a distributed setting there's no way of solving that, short of solving distributed consensus. Cloud Haskell [2] section 4 touches this as well. [1]: http://studentarbeten.chalmers.se/publication/256251-singly-typed-actors-in-agda-an-approach-to-distributed-programming-with-dependent-types http://studentarbeten.chalmers.se/publication/256251-singly-... [2]: https://www.microsoft.com/en-us/research/wp-content/uploads/2016/07/remote.pdf https://www.microsoft.com/en-us/research/wp-content/uploads/...
- jerf 8y ago"pretty much the only widely used CSP implementation in existence" The history of programming shows a lot of evidence that good ideas can take decades from initial proposal to even being in a B-list language like Go, let alone being "widely used" to the degree I think you are, so I put only modest credence in it being not terribly widely used yet. "And Go itself is constantly fighting CSP deficiencies, trying to abstract it away and move closer to actors." Having programmed in Erlang for a long time, I don't find this to be true. I've certainly got quite a few things that look like actors, but quite a lot of things that definitely aren't, too. "CSP alone cannot be used for anything real world related" Which probably goes back to why everyone tends to tweak it a bit. (I have further quibbles with that characterization, but not important enough to go into.) And Go doesn't offer "CSP alone", but rather CSP grafted on to the side of a standard structured programming model, something we do know can be used for real-world work, so it all seems to work out pretty well.
- mollusk 8y ago>Go is pretty much the only widely used CSP implementation in existence. Clojure’s core.async is another arguably widely used implementation (it pays my bills).