-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Functional Programming vs. OOP
Functional language are stateless,
Incorrect. Imperative state effects are managed in the monad paradigm of pure FP.
There’s the Optionally declare functions pure? issue thread #4 for discussing monads and a general Language Discussion thread #1. There’s also a discussion of pure effects systems in the latter portion of the Concurrency issues thread #17.
and i dont see well how stateless program can be converted to goroutine and channels efficiently.
I already told you that the #35 issues thread (where this discussion originated) is not about creating a pure FP language.
But maybe i'm missing something or you have another definition of FP.
I already gave you the superset definition of FP:
Go has first-class, higher-order functions, closures, and GC. Therefore it is a FP language. Just not a pure FP language.
I really grow weary when having discussions with you because it’s as if the relevance of what I write doesn’t sink in for you the first, second, or even sometimes the 3rd or 4th time it is explained. How many more times do I have to explain that pure FP is not all of FP.
For me where i put the frontier between FP and imperative is statfullness or not.
FP is not about avoiding state. That seems to be the stumbling block of your persistent misconceptualization.
FP is about the definition I quoted above.
OOP binds data to methods in objects at instantiation and includes the anti-pattern of virtual inheritance. FP employs dependency injection of functions along with data that function call, which is late binding of interface to data (aka “interface inheritance”). Typeclasses automate (and make implicit) this FP capability.
So the reason you do not comprehend the significance of what we are doing is because you haven’t yet grokked the distinction between FP and OOP. And how typeclasses are simply an automation of FP late binding dependency injection.
The strictly pure (and lazy evaluation) variant of FP is more focused on the mathematical definition of a function and equational reasoning. Monads are employed in order to model stateful effects in the pure FP paradigm.
P.S. I know you are a highly productive programmer once you understand. So I hope we could attain mutual understanding.