Hacker News new | ask | show | jobs
by jashkenas 5419 days ago
It is indeed nasty ... and for that extra nastiness, above and beyond the inheritance pattern listed above, you get:

* A subclass that inherits the parent's implementation of the constructor function, unless overridden.

* A named function for your class object, without IE scope leaks.

* A way to call super that's as easy as `super()`.

* Inheritance of the parent's own properties (unfortunately via copying).

* ... which enables helpful metaprogramming within class bodies. For example, Batman's own `event` decorator:

    use: @event (times) ->
      return false unless ...