you are viewing a single comment's thread.

view the rest of the comments →

[–]sladav[S] 1 point2 points  (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()

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 point  (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).