7 ms·
Yes, CoffeeScript is amazing. No more headaches over missing semi-colons, callbacks feel significantly less "spaghetti-like". Syntactically it feels much cleane
by icey 16y ago
Yes, CoffeeScript is amazing. No more headaches over missing semi-colons, callbacks feel significantly less "spaghetti-like". Syntactically it feels much cleaner and I've found that I end up staying much nearer to the left margin than I did with JavaScript.
Debugging has not been a problem for me yet, the generated JavaScript is very clean and easy to navigate.
That being said, I'm a Python fan, so I consider significant whitespace to be a feature, not an irritant.
- DanielRibeiro 16y agoSecond that. Coffeescript is really life changing. A very DSL friendly language, where beautiful code can rival python's[1] [1] http://metaphysicaldeveloper.wordpress.com/2011/03/31/354/ http://metaphysicaldeveloper.wordpress.com/2011/03/31/354/
- icey 16y agoNow I have to put on my fruity hippie developer hat. I feel like it makes a big difference when a language implementor values beauty in code. CoffeeScript was created by someone who values the aesthetics of code, and it shows. The CoffeeScript documentation is a fantastic exposition of that: http://jashkenas.github.com/coffee-script/ http://jashkenas.github.com/coffee-script/
- Cushman 16y agoIndeed. Newcomers usually describe CS as "Pythonesque" (because of significant whitespace) or "Rubyish" (because of optional parentheses) depending where they're coming from. I find that a little funny. Truth is, it's borrowed from both, and other languages besides, to synthesize a gorgeous syntax which is really its own.
- MatthewPhillips 16y agoIt's hard to debug when you get compile errors though. I gave up on the language when I could not figure out why a script wouldn't compile; the errors given are basically worthless. Later I opened the file on Windows (Notepad++) and saw that one line had not been indented, which wasn't showing up on Vim/Gedit. I never tested it to see if that was indeed the problem, I'd already moved on.
- xpaulbettsx 16y agoPaste this line into your files: # vim: ts=2 sw=2 et :
- MatthewPhillips 16y agoOk... care to explain?
- deleted 16y ago[deleted]
- mdwrigh2 16y agoIt's a directive for VIM to set the tabstop to 2, the shiftwidth to 2 and to enable the expandtab option. The tabstop variable sets the ratio of tabs to spaces (in this case, one tab is equivalent to two spaces). The shiftwidth variable controls how much a line gets moved when it gets "shifted". In VIM pressing << in Normal mode on a line does a left shift. With a shiftwidth of two, it will move it over two spaces to the left. >> is right shift. There are many more ways of shifting, however. The expandtab option sets it up so that every time you hit the tab key, VIM will insert the equivalent number of spaces according to the tabstop. In this case, pressing tab will give you two spaces.
- xpaulbettsx 16y agoThis makes sure that your CoffeeScript files never end up with mixed tabs/spaces, which will result in the compiler getting confused, and your hair being pulled out from "invisible syntax errors"
- technomancy 16y agoIt's a shame that this hack is necessary; it would have been so easy for the language designer to simply declare that any tab characters used as indentation result in a syntax error, and poof: a whole class of errors simply become impossible. Don't get me wrong; I will probably reach straight for coffeescript the next time I write code that runs in a browser, but this is the one thing that cools my enthusiasm for it.