4 ms·
I am not sure but I think Go channels were inspired by CSP (communicating sequential processes) which is not inherently unsafe though.
by fogetti 8y ago
I am not sure but I think Go channels were inspired by CSP (communicating sequential processes) which is not inherently unsafe though.
- leshow 8y agofrom the article: > Notice that this article does not include Go, a language that admittedly has an elegant concurrency solution as well (Go channels) because that solution is not actually thread-safe - it's not very hard to have race conditions in Go or corrupt state because Go does not enforce a separation of shareable and not-shareable mutable state.
- hn98823993 8y agoThat's incorrect though. It's impossible to have data races with Go channels. The example the author gives doesn't use them.
- jerf 8y agoMy vote for Go's #1 mistake isn't the popular "lacking generics", but missing the opportunity to have fearless concurrency, and making it so that goroutines can only communicate via immutable shared values and copied values. If you want to optionally and explicitly penetrate that barrier sometimes, I'd be OK with that, but this should be the default. Generics will probably be added after the fact 10 years after the 1.0 release. They may not be quite as slick as something that was in there from the beginning, but based on the many other languages that added them after the fact, it'll probably work out well enough. Fearless concurrency can't be added to a language; if it's not in there from the beginning it'll never be added. It's a change so big it's almost automatically a new language. And, as can be logically deduced from that statement, I am aware that it would have some additional effects in the language, such as introducing immutability, it wouldn't be simply what we now know as "Go" with just a minor tweak. I'm comfortable with that. Even with Go's focus on simplicity, I do think there was a slight error towards being a bit simpler than the problem permits here. (I do pretty well with Go's concurrency, but I was first trained brutally by Erlang and Haskell. I see those who don't come by the same route have more trouble.)
- fogetti 8y agoSo you didn't understand what I said? CSP is not unsafe. What is your point of quoting if you don't even understand what I said?