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

There's no reason to confine "class" to just mean C++/Java style inheritance, just because it was used that way first.

Besides, most people used prototype based inheritance in this exact manner, so it's good to codify and give a concrete implementation, instead of 200 ad-hoc remakes of the same thing.

Third, people still get all the prototypal flexibility anyway if they want it.




> instead of 200 ad-hoc remakes of the same thing

I think that's a good argument for including the syntax, though it raises me from 'anti' to 'ambivalent'. But yeah, figuring out random coder's favourite OOP implementation style is an annoyance. Here Crockford seems to be a bit part of the problem: he seems to recommend a whole new approach every couple of years. His recommendations to never use 'new' (and now, don't use 'this') make it a pain to use other people's objects.

I wonder if a better consensus might be the best of all worlds.


> he seems to recommend a whole new approach every couple of years

you make that sound like a negative. If you find a 'better' way, why not use it?


Indeed, the problem is on code bases or teams with multiple ways of doing the same thing. I define new objects with.

    var foo = Object.create(bar);
You do

    var foo = new Bar();
Amy does

    var foo = Bar();
and Ellen does

    var foo = Bar.create();
For many values of 'better', the advantage is much smaller than the additional burden.

Thus I have no problem with him finding better ways, but his influence and his way of presenting things as the one best solution causes issues, in my experience.


Well, I was using thisless style all along, and it's nice to get company. I'm a little saddened 'class' will probably win out.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: