3 ms·
> In non-OOP languages, like JavaScript, functions can exist separately from objects. It was such a relief to no longer have to invent weird concepts (Something
by dreamcompiler 7y ago
> In non-OOP languages, like JavaScript, functions can exist separately from objects. It was such a relief to no longer have to invent weird concepts (SomethingManager) just to contain the functions.
This is one of the things CLOS (Common Lisp Object System) got right: It's object-oriented but functions are not "owned" by classes; they're separate and first-class and generic and can dispatch on multiple arguments. In CLOS, classes are truly just user-defined types, and classes don't impede your ability to write functional code.
- fengb 7y agoIs he seriously using Javascript as an example of non-OOP language?
- naikrovek 7y agoHaving the idea of objects does not make a language "object oriented." Compartmentalization and encapsulation are fundamental concepts of objects and those concepts existed long before "OOP" did
- pjmlp 7y agoThat was called modular programming. SELF, which JavaScript takes its model from, is definitely OOP.
- claytonjy 7y agoSounds a lot like R, which I've seen smarter folks say is really quite Lisp-like.
- madhadron 7y agoR uses a generic function, multiple dispatch object system modeled on CLOS, so, yes, it's a lot like R. I found CLOS a bit less obscure to work with, but I never really took the time to dig to the bottom of R and tunnel back up.