A face-washed JavaScript with classes, interfaces and such stuff. I was expecting something more syntactically close to Go, or at least to Python.
That said, CoffeeScript provides another interesting use for them: Simulating dynamic binding. Basically, the trick is that `this` becomes the dynamic binding context and `@` represents a dynamically bound variable. You use `fn.call @, x, y, etc...` if you want to pass the dynamic binding to callees. Nested bindings can be established with `Object.create`
> leaky and half-featured classes.
This is a common willful misconception. CoffeeScript classes are isomorphic to JavaScript prototypes -- the do precisely the same thing. In addition, there is a shorthand syntax for prototyping objects, if that's more your style: Dog = ->
...
Dog::bark = ->
...
Dog::run = ->
...
Note that the above will produce the same result as: class Dog
bark: ->
...
run: ->
...- JQuery examples like to abuse 'this'.
- I should always, explictly provide the event as a parameter in the callback.
So '@' is always the object, and 'event' is whatever started the method.
I never use inheritance.
Since I started to do this, my code has become much simpler and cleaner.