|
|
|
|
|
by timr
6400 days ago
|
|
So, you're suggesting that functional programs are somehow totally stateless? Otherwise, I don't really see your point. All useful programs store state somewhere. The fact that OO programs couple state and code doesn't make them procedural. Functional programs just tend to muss over this detail by using closures and anonymous functions (aka "objects") to keep track of state. An object-oriented program is not required to be expressed in terms of a "sequence of steps" any more than is a functional program. You can instantiate objects that talk to one another, asynchronously or otherwise, to collaboratively do work. |
|
Anyone who has worked with a pure OO language knows that there's nothing inherently imperative about the approach.
Can you provide some examples of how you might write "non-imperative" programs in a mainstream object-oriented language?
An object-oriented program is not required to be expressed in terms of a "sequence of steps" any more than is a functional program
A functional program is not a "sequence of steps"; in principle, it is just a mathematical expression that can be evaluated (via some means) to yield a value (think of a SQL query or a Prolog program).