Hacker News new | past | comments | ask | show | jobs | submit login

Not recommended if you have lots of objects with this interface. Each object will have its own copy of each function. Using a class with the methods in a prototype ensures there is only one copy for all object instances.

It also makes specialization and calling super methods super verbose.

And you've ultimately not done anything other than reimplementing OOP, poorly.




You're not supposed to use `super` or specialization with factory functions, call the functions you need instead.

OOP inheritance does not belong in this pattern, even if you could hamfist it in (which you've already observed as unwieldy).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: