Rubyのattr_reader的なことをBackbone.js + CoffeeScriptでやると、綺麗に書ける。すばらしいですね。
Finally, class definitions are blocks of executable code, which make for interesting metaprogramming possibilities. Because in the context of a class definition,
this
is the class object itself (the constructor function), you can assign static properties by using
@property: value
, and call functions defined in parent classes:@attr 'title', type: 'text'