Punctuation in Language Design is Good
It’s all about CoffeeScript (and quietly about Ruby).
Why do people feel the need to remove punctuation? I came across the following code snippet:
1class TenFarms.View extends Backbone.View
2 constructor: ->
3 functions = _.difference _.functions(this), _.functions(TenFarms.View.prototype)
4 _.bindAll.apply _, [this, "render"].concat(functions)
5 super
What I like and dislike – in line # order
- This is much better than the JavaScript equivalent – hands down.
- Nice, define a function.
- The beef
- GOOD – Sure you don’t need “var”
- BAD – Why no parens around _.difference(_.functions(this), …)
- Again, we’re depending on whitespace to cause things to happen.
- Think about this is: “A B” a function call? What About “A B, C D” – did I forget a comma or is that two function call “A(B, C(D))”
- “super” that’s good – better than the JavaScript version.
Bottom line, is when I’m reading Ruby or CoffeeScript I’m driven somewhat batty by when a function call happens. All because they dropped the (…) requirement and now have some ambiguous cases. Part of me has to wonder sometimes if the heavy emphasis on TDD is because of the adoption of such programming languages.