4 ms·
This is very awesome (I was talking with someone the day before last about how something like this should exist). On a very different note: why is it that the
by lelandbatey 14y ago
This is very awesome (I was talking with someone the day before last about how something like this should exist).
On a very different note: why is it that the default "tab" in so many of these online editors is just two spaces? It seems to be a thing in many online code based editors, and I don't know why. Is that a common convention for the languages that the authors of these in-browser-editors use? What's the deal? And why can't I change it to four spaces?
- randall 14y agoI think a lot of people use two spaces in diff communities. I prefer two, but I'm not sure if it's because I'm in these communities or what.
- drivingmenuts 14y agoI'm a four-space tab person, myself. Two spaces looks like a typo rather than an indent, to me. At one time there was a movement afoot for some sort flexible tabbing (using actual tabs) but it seems to have died out.
- davefp 14y agoTwo space indentation for me. That's pretty much the default for ruby code AFAIK. I'm somewhat ambivalent about it though. On the one hand I find it easier to read (less scanning back and forth across the page) but on the other it is forgiving to deeply nested code.
- GoranM 14y agoI prefer tabs, set to 8 spaces; More readable, and makes bad code obvious. 4 spaces I can somewhat understand, but 2 ... ?
- SeanDav 14y agowow, you guys just don't have a clue ;P It's 3 space tabbing or go home. (I am actually serious, about the space part, not the clue part. 2 spaces looks like a typo and 4 wastes space once you indent a couple of times. Got to be 3, although if I had to choose, 2 or 4, then definitely 4.)
- hayksaakian 14y agoin languages that enforce spacing 4 makes sense, but otherwise why bother with it? larger spacing discourages pyramid code (like in python which is stylistically functional), but sometimes (eg: HTML) this is unavoidable, and 4 spaces are a nightmare
- mweibel 14y agoWell, I'll be that guy then: Why are people not using tabs instead of spaces? Really: I couldn't care less about how much spaces my team mate is using for a tab. I just know: Indent by tab, and everyone can set their settings on their own and it looks always perfectly indented.
- sgk284 14y agoRelevant: http://www.jwz.org/doc/tabs-vs-spaces.html http://www.jwz.org/doc/tabs-vs-spaces.html tl;dr; Spaces are the correct technical choice due to interop issues with TAB.
- BHSPitMonkey 14y agoInterop issues which, in real life, never actually surface as issues for anybody. I'm personally in the camp that feels that spaces are logically inferior; A tab uses one character to represent some atomic idea that you intend to declare (an indent level). Replicating this intent with sequences of repeated spaces is on par with centering text on a web page by using Hello World! instead of setting the text-align CSS style. (Just as that method prevents the browser from centering the text correctly according to the user's chosen viewport size, so using spaces for indentation prevents an editor from letting a user read code the way they would prefer to.) Of course, if the project/platform you're working in has an established style guide or convention in place, go with that :)
- mweibel 14y agoExactly that is what I think as well.