Of course sometimes stateful (procedural) interfaces are a must, but it's surprising how many painful OOP classes can be replaced with a "const struct foo" interface with a clear meaning to the data in it.
Of course sometimes stateful (procedural) interfaces are a must, but it's surprising how many painful OOP classes can be replaced with a "const struct foo" interface with a clear meaning to the data in it.
Of course you can declare everything is data. You don't need higher order functions for that. But real data is simple and introspectable. Computation is not.
Let me try to rephrase with an example. Eg you might have an API for a file that allows you to open a file, manipulate it, and then close it. That's a very procedural interface.
As an alternative, think of an interface like the following:
withOpenFile(filename, manipulator)
that opens a the file, calls the manipulator function on the contents, and automatically closes it.Or compare map, filter and reduce vs manually iterating over a collection of items.
I did really like your grandfather comment (https://news.ycombinator.com/item?id=11099224). I hope I've cleared up my point?