4 ms·
Indentation is semantic only in Python (which incidentally uses spaces). In any other language it's a purely visual property - the code works the same regardles
by Grue3 7y ago
Indentation is semantic only in Python (which incidentally uses spaces). In any other language it's a purely visual property - the code works the same regardless of indentation.
- jnty 7y agoI think you've misunderstood the use of semantic here - it's semantic for all text files. Instead of describing very exactly 'put 8 spaces here' you're saying 'for some reason this line needs to be indented once, take this information display this as you wish.'
- maeln 7y agoIndentation is semantic has in it carry a meaning. We are not talking about how a specific language use it. As for Python, it doesn't use space. It can use both spaces and tabs (but not mixed within the same file). It's just that PEP-8 require spaces, but not every project/library follow PEP-8.
- majewsky 7y ago> Indentation is semantic only in Python And in Haskell. And in Nim. And in Haml. And in Sass. And in YAML. https://en.wikipedia.org/wiki/Off-side_rule#Off-side_rule_languages https://en.wikipedia.org/wiki/Off-side_rule#Off-side_rule_la...
- jlg23 7y agoIn those languages where it is not semantic, proper indentation still gives visual clues to the semantics: With proper indentation one can read programs in lots of languages even without their specific semantic markers. A simple way to see this is to configure your editor's syntax highlighting to use the background color for parenthesis, semicolons or whatever the markers are in your language of choice.