4 ms·
It's worth re-reading the quote again: "Imperative languages offer no protection against data races" ...and this is true. An imperative language (in and of its
by j_baker 13y ago
It's worth re-reading the quote again: "Imperative languages offer no protection against data races"
...and this is true. An imperative language (in and of itself) has no protection against data races. That's not to say that imperative languages can't have code without data races. It just means that the language itself offers no protection.
Functional languages (basically only Haskell - I consider Scala an imperative language) have protections due to the Church-Rosser theorem[1], which states that (in essence) pure code can be executed in any order and there won't be any race conditions.
The rub (which is what I think you're getting at) is that it's dubious whether languages like Haskell are practical in a real-life production environment. Imperative languages "get things done", and given judicious use of appropriate libraries may be able to do concurrency just as well if not better than a purely functional language like Haskell.
[1] https://en.wikipedia.org/wiki/Church-Rosser https://en.wikipedia.org/wiki/Church-Rosser
- mbrock 13y agoI don't know any languages that are practical in a real-life production environment. They all kind of suck in their own special ways. What makes you think Haskell's practicality is more dubious than any other?