4 ms·
In my opinion, functional programming, like most programming terms, including object-oriented programming, means very different things to different people. For
by sreque 10y ago
In my opinion, functional programming, like most programming terms, including object-oriented programming, means very different things to different people. For example:
1. The LISP family of languages encourages a style of functional programming that eschews static type systems, relies heavily on macros and algorithms involving singly-linked lists, and doesn't mind exposing the ability to mutate state.
2. The ML family of languages, of which I am the least familiar, are statically typed, but are also OK exposing mutable state and do not track any effects in their type systems.
3. Haskell heavily pushes reliance on Monads, monad transformers, and effects/state tracking through the above.
4. Proof assistants and similar languages like Coq go beyond tracking effects in the type system; they track values themselves, and essentially require you to prove mathematically that your program is correct.
So, given the above, what do you mean by functional programming? From the talks I've seen given by the creator of Scala itself, I believe he sees Scala as fitting in with the ML family languages moreso than Haskell.
Also, the way Scala's type system and runtime currently work, I don't think it's a good fit for Haskell-style programming. I tend to find monad transformer-based code in Scala exceedingly ugly and difficult to read compared to Haskell. The underlying runtime itself also has little mechanism for optimizing monad-based code, whereas the GHC compiler has probably man-years of effort spent into optimizing code using monads.