Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

"Coffeescript inheritance semantics" aren't anything special in javascript. If the editor was written in javascript syntax and still chose to make use of inheritance in its design, extensions would look the same.

This works just fine, and it can't get much more javascripty:

    ExtensionComponent.prototype = Object.create(Component.prototype);
    function ExtensionComponent() {
      Component.call(this);
    }

    ExtensionComponent.prototype.doSomething = function () {
      // ...
    };


Have you actually tried it?

Seems like the people who actually have found it a little more complicated than that (see http://discuss.atom.io/t/coffeescript---extends-vs-util-inhe...).

To quote the post:

    The difference is important. CS copies functions from parent to child on top of 
    setting the prototype while the std library just does the latter. Inheriting from 
    require("atom").View breaks without doing this manually (which isn't obvious at all). 
    If this is not being done for performance, it should be documented; otherwise, those
    methods should be moved to the prototype.




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

Search: