3 ms·
I think you're attacking a straw man by very narrowly defining "imperative programming". Wikipedia says imperative programming is "a programming paradigm that d
by pron 12y ago
I think you're attacking a straw man by very narrowly defining "imperative programming". Wikipedia says imperative programming is "a programming paradigm that describes computation in terms of statements that change a program state" (this is as opposed to declarative programming, BTW, and not not functional programming, which has no accepted definition at all). There is nothing in there saying that state has to be shared, or if it is, whether or not it can have transactional semantics. Using shared, mutable state with transactional semantics in an imperative style has none of the problems you mentioned; neither does non-shared mutable state, which is just as much a cornerstone of imperative programming as shared state.
You're also implying it is possible to program without shared mutable state. To the best of my knowledge, practically every interesting program (other than compilers) has shared mutable state (yes, even Haskell programs), even if it is delegated to a database (which, of course, also has to be concurrent, and has to be programmed by someone).
Now, the quest for a true general purpose STM has been abandoned, but more domain-specific forms (or even in-memory databases, which are, essentially, STM) are still very much in the game.