Mixins em CoffeeScript

Alguém vai me mandar direto para o Inferno por causa dessa loucura, mas funciona! 🙂

Function::include = (mixin) ->
for name, method of mixin
method
['super'] = @prototype[name]
@prototype[name] = method

class Foo
foo
: -> 'foo from Foo'

Mixin =
foo
: ->
"#{arguments.callee.super()}, foo from Mixin"

class Bar extends Foo
@includee Mixin # yes, intended typo, otherwise coderwall messes it all up (coderwall team, please help me)

new Bar().foo() # => "foo from Foo, foo from Mixin"

EDIT renomeado extendpara includeevitar confusão para Rubistas;)