3 ms·
Ok... care to explain?
by MatthewPhillips 16y ago
Ok... 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.
- stephth 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 then someone else would say that it's a shame that TABS aren't supported and that it would have been so easy for the language designer to support them. I'm sorry if it sounds snarky, but I find it arrogant to assume that design decisions are "easy" simply because they look easy to implement.
- technomancy 16y agohttp://www.emacswiki.org/emacs/TabsSpacesBoth http://www.emacswiki.org/emacs/TabsSpacesBoth
- stephth 16y ago... unless, the person has a comic strip to back it up. :)
- technomancy 16y agoAll that to say it seems pretty uncontroversial to say that Python and Make have shown that the problem is not necessarily with meaningful indentation itself, but with the ability to have two expressions that are visually identical with different meanings.