When I want to write a class in Coffeescript that provides a chain of methods, I often run into the problem of having one liner in principle, but then adding a row to actually return an instance for the chain.
So, instead of writing a simple setter, for example:
class myClass
setProperty: (value) -> @property = value
I have to break it and do it like this:
class myClass
setProperty: (value) ->
@property = value
@
In my eyes, this really reduces the readability and compactness of the code, especially if you have many setters and other self-evident single inserts.
So, I thought about doing it differently and again adding a semicolon to my code, for example:
class myClass
setProperty: (value) -> @property = value; @
The compiled JavaScript is actually the same, but although it's pretty handy, it also feels a little messy to do it this way.
( ) Coffeescript?
EDIT: , , :
class myClass
setProperty: (@property) -> @