rtrd3g
Last Updated: February 25, 2016
·
1.27K
· lucaong

Avoiding a trap with CoffeeScript inheritance

If you ask me, CoffeeScript is simply awesome. Last time I had such a fun time hacking with a new language was long ago, when I moved my first steps into Ruby. But as always, when you play with a new toy, inevitably you get to experience also some rough edges.

To be honest, the issue I am talking about is purely a JavaScript one, dealing with prototypal inheritance and non-primitive properties. But yet, CoffeeScript makes inheritance so elegant that you are more likely to create and extend a lot of classes, and eventually to run into this.

I wrote a short blog post about this trap and how to avoid it: Non-primitive Properties, CoffeeScript Inheritance and Class Macros. Hope you can find it helpful.