|
|
|
|
|
by dangrover
6416 days ago
|
|
I think it's because you can easily make your own object system in a functional language. Make yourself a function (representing an object) that takes in a parameter that it uses to dispatch a function contained in it. Return the function, and the user can then call that with their args. And you still maintain encapsulation, too, because the returned function may access stuff that was only available inside the containing closure (where it was dispatched). Put all of this together in a nice "class" macro, and bam, you've got objects. Though, yeah, I guess this would be really tedious if your functional language didn't have good macros. |
|
That only works if your functions can maintain state and if they can, well they're basically objects aren't they...