Use @
when calling instance methods and fields not when defining:
class Foo
a: 1
b: 2
main: ->
if @a == 1
@log(1)
log: (num) ->
console.log(num)
f = new Foo()
f.main()
Defining methods with @
like this
@log: (num) ->
console.log(num)
makes them static.
Look at the compiled JS while developing on CoffeeScript.