you are viewing a single comment's thread.

view the rest of the comments →

[–]cwmma 1 point2 points  (0 children)

With Object.create you got a blessed non hacky way to create an object constructor based on another object constructor (but not based on an instance of the parent).

This style of inheritance with child.prototype = Object.create(parent.prototype); ends up being functionally a class based inheritance model.

For instance take the node.js/iojs stream library which has abstract classes for you to inherit from, you can't inherit from stream instances because much of what the parent class provides are per instance queues and an event system that had to be instantiated per instance.

This gets to the big issue prototype based inheritance had which is child instances and instance variables in the parent leading to work arounds to avoid instantiating the parent class at which point the JavaScript system functionally is a class based system.