5 ms·
Not really, from what I gather it's closer to a functional language that lets you implement objects with private data by using closures.
by Fr0styMatt 13y ago
Not really, from what I gather it's closer to a functional language that lets you implement objects with private data by using closures.
- gnaritas 13y agoYes really. It's an OO language based on Self's prototypical OO model rather than a class based OO model. Prototypical OO is still OO, unless you're claiming Self isn't OO, but the Smalltalker's who invented Self would very much disagree. Prototypes are objects, no closures or classes required.
- Fr0styMatt 13y agoAh, I stand corrected, thanks. Makes sense; I think I had something about private vars in JavaScript and closures running through my head and confused it with 'JavaScript does OO with closures' :)
- gnaritas 13y agoNo problem. People who don't like or get prototypes have certainly reimplemented classes with closures, but classes are not a requirement to be OO, objects are; classes are just one way to do it, prototypes are another. Objects don't require classes, though many a JavaScript programmer thinks so.
- Fr0styMatt 13y agoFWIW by the way, I don't get all the JavaScript hate either, other than perhaps it's from people who erroneously think they don't have any choice except to use JavaScript on the client side. From what I've seen of JS as a language, I actually quite like it, but haven't used it for anything substantial. I do like what we seem to be arriving at with asm.js; a subset of JS as the assembly language of the web, with people being able to choose the language that best fits their problem domain and target the JS machine.