by noelwelsh · 6y ago · 0 comments
You also didn't mention F# or ReasonML.
Or are those too much like FP for your point?
(I think Scheme and ML both have a claim to be O.G. strict impure FP, as both were developed at about the same time in the 1970s. O'Caml is more recent IIRC.)
One reply observes they don't have pure functions which is rather fundamental to most modern definitions of an FP language. But they also use imperative flow control in which statement ordering matters, their APIs are object oriented, there's no lazyness, type inference is intentionally limited.
I don't think they've really borrowed many ideas from academic FP. Most such ideas were in fact explicitly rejected.
So random languages just pick what they like (lambda expressions, weaker forms of algebraic data types, sometimes the complete typeclass concept, various forms of Monads from "unnecessarily specialized because whoever picked it didn't understand it" to "properly done"0.
And while having pure functions certainly forces you to get things right, you don't need to do this when copying ideas. And there are functional languages (some very old, like Lisp) that never had pure functions in the first places.
A language that can track purity is great, but not absolutely required.
Btw, the D language does have facilities to track purity. It's not a functional language, though.
One says FP is about using functions with closures, higher order functions and anonymous functions as the main building blocks for modeling your program logic. This style is championed by Scheme and other Lisps. It is also slowly creeping up in all major languages.
The other is about immutable data and pure functions, and modeling your program using those as your main building blocks. Either as much as possible, and sometimes even going as far as restricting yourself only to this.