by zackzackzack · 13y ago · 0 comments
Functional programming is a style of programming which uses the lambda calculus as its base model of computation. Just because you can subvert that at times doesn't mean that idiomatic code doesn't disapprove of breaking referential transparency.
The ST monad is there for many reasons but if you can avoid it you probably should. If profiling says it's necessary, then add it.
Look at Coq.
They basically describe a modified C# language, with global state (static variables) eliminated - any global state is immutable only. Naturally, anything marked immutable cannot access anything marked writable, so unless you want to put writable permissions on everything (turning it back into standard OOP), you're going to need to design programs around immutable data by default. Also, anything marked writable in the new language can only be written to by one thread at a time anyway, since the writable references are unique.
The result is a significantly different style to the traditional imperative OOP people are used to, so it's not like you can lift an existing program into this paradigm without problems.
If the author thinks that FP won't become mainstream, what makes him think that this will?
"In most FP languages, variables are declared immutable by default."
That doesn't sound like a claim that mutable state is impossible. Perhaps we should spend more time reading and less time criticizing...