|
|
|
|
|
by savingGrace
2207 days ago
|
|
I felt as though I should know the moral of the story, yet I did not. https://stackoverflow.com/a/11421598
Moral of the story is that closures and objects are ideas that are expressible in terms of each other, and none is more fundamental than the other. That's all there is to the statement under consideration. |
|
I don't think the fact that you call `file.seek` vs `seek(file)` the difference between functional and object oriented. functional people say "state = evil, side effects = evil" and yet that version of `seek` has both.
The functional version of files would have to move the head out of the file
newWritePosition = write(file, currrentWritePosition)
And there would be no need for seek since you're holding your own write and/or read position.
If you close over a bunch of state and pass back a function or functions to work with that closed state you've just created an object with state and side effects. That's exactly what FP people say is bad.