3 ms·
Thinking CSP is something you can replace with atomic types and locks is a common misconception. Goroutines and channels are the primitives used by CSP, but jus
by eikenberry 4y ago
Thinking CSP is something you can replace with atomic types and locks is a common misconception. Goroutines and channels are the primitives used by CSP, but just using them is not CSP. CSP is a whole program design system that can use all the concurrency primitives. There is no conflict between the using CSP and locks/atomic types. They work well together as they have different uses.
The misconception is pretty widespread and cancerous to the community. Ignoring CSP is ignoring Go's best feature for writing better code. It takes some time to learn to do well (I'm still working on it) as it is a different paradigm than most people are used to, but it is well worth the effort IMO.