Hacker News new | ask | show | jobs
by tengbretson 663 days ago
Is being a "prototypal language" not an "OO inheritance model"?
1 comments

Firstly, it’s functional with closures… From there prototypal - so you can express whatever you want… the key is being functional. This was a key to the advent of JSON, but is also one of the most elegant and powerful bits of JS
You're wrong. The prototypical model of JS was inspired by the Self programming language[0], itself a descendant of Smalltalk. It is a very crude implementation for sure, but it is object programming nevertheless. Closures being present sours the purity a bit, but closures are poor man's objects[1] anyway.

[0]: https://selflanguage.org/

[1]: https://stackoverflow.com/a/11421598

Also, Smalltalk was heavily inspired by LISP[0]. The line between functional and object-oriented is quite blurry. Especially in a pure OO language like Smalltalk. The dynamic and prototypical model of JS is definitely another example of the subtle harmony of functional and OO.

[0]: https://worrydream.com/EarlyHistoryOfSmalltalk/

I agree 100%. I firmly hold the belief that the two paradigms are just different perspectives of looking at the same thing (state and behavior). Also see https://insearchofsecrets.com/2014/08/04/lisp-smalltalk-and-...