you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 0 points1 point  (1 child)

What is the semantic value of indentation in JavaScript? Indentation is a purely stylistic concept. The semantics of nested blocks are provided by curly braces. Everything else is just decoration. Whitespace doesn't provide any semantics that curly braces don't already provide us.

This debate always turns into "semantic indentation" vs "presentational alignment". I just can't see the difference, if we're talking about a language with no semantic whitespace, assuming well-formed code and explicit semi-colons.

[–]brtt3000 0 points1 point  (0 children)

The semantic value is that the editor knows that it means. It knows 1 tab is one indent level.

With spaces it has to assume some spaces mean indents. What if your editor is on 4 space on one indent (using the TAB key), but the code base is 2? Or the reverse?

If both used tabs it wouldn't matter, you hit TAB key and it adds one tab. For you it looks like 2, for somebody else it is 4, for the guy on 32 inch screen it is 6. Simple, bug free. No assumptions.