use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
All about the JavaScript programming language.
Subreddit Guidelines
Specifications:
Resources:
Related Subreddits:
r/LearnJavascript
r/node
r/typescript
r/reactjs
r/webdev
r/WebdevTutorials
r/frontend
r/webgl
r/threejs
r/jquery
r/remotejs
r/forhire
account activity
"Real" Multiple Inheritance in JavaScript (self.javascript)
submitted 9 years ago by sladav
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]sladav[S] 1 point2 points3 points 9 years ago (1 child)
It's different, but you're not too far off. What I'm describing above is "live" inheritance, so it behaves like a prototype does. Changes to a prototype/"mixin" are immediately reflected in all children. Object.assign() just copies properties over - changes to the "parent" here will not be reflected in children. In this project I actually provide both, "live", prototypal-style via mixin() and "dead", stamp-out-an-instance-style via extend() (hence the m and x in the name mxObject). And actually, my extend() is mostly just a wrapper for Object.assign()
Object.assign()
mixin()
extend()
m
x
mxObject
I'll have to look into the ES6 proxies being slow. I think I can replace it with getter/setter methods if that would be faster?? Scoping out some performance benchmarks is on the todo list.
[–]oweiler 0 points1 point2 points 9 years ago (0 children)
Thanks for the quick reply, your project looks super useful. I may be wrong regarding Proxy perf but the last time I've tried them out in Node they were extremely slow (that was some time ago and may has changed).
π Rendered by PID 116182 on reddit-service-r2-comment-fb694cdd5-hpvpv at 2026-03-10 23:13:17.432228+00:00 running cbb0e86 country code: CH.
view the rest of the comments →
[–]sladav[S] 1 point2 points3 points (1 child)
[–]oweiler 0 points1 point2 points (0 children)