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

I've been doing something like this since 2007 on code bases that run into the many hundreds of thousands of lines of code.

It is actually the correct way to do classical inheritance in javascript, everything else is trimming, convenience, backwards compatibility or is simply wrong. In fact almost every other 'pattern' out there does this at the heart of it.

So, for example you'll see some people use a surrogate instead of doing Object.create (as I did when I first started doing this). That's just doing exactly the same thing as Object.create, but in such a way as to work in pre ecmascript 5 browsers - we didn't have Object.create back then.

http://kybernetikos.com/2007/02/07/inheritance-and-javascrip...



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

Search: