Moved subjects in sentences around, general edits.
This commit is contained in:
parent
8739680508
commit
42ba333457
|
@ -1,12 +1,12 @@
|
|||
# WIP (really unfinished)
|
||||
|
||||
Virtually all programming languages use whitespace as part of their syntax. Many only as a token separator. Whitespace by itself is invisible, and you can't differentiate a tab from a space w/o some kind of editor highlighting. However, it has very visible effects on the code around it and, even when not needed, programmers use it to make the code more human readable. Whitespace in nimrod is only used as part of syntax in those cases.
|
||||
Virtually all programming languages use whitespace as part of their syntax. Many only as a token separator. Whitespace by itself is invisible, and you can't differentiate a tab from a space without editor highlighting or differentiation. Despite this, whitespace has very visible effects on the code around it and, even when not strictly required by a language's syntax, programmers still use it to make code readable. Whitespace in nimrod is only used as part of syntax in those cases.
|
||||
|
||||
# New Lines
|
||||
|
||||
Most statements have only one line. With semicolons languages, you pay a tax every line to be able to use multiline statements eventually. But as presented bellow, Nimrod lets you use multiline statements most of the time w/o requiring this semicolon tax.
|
||||
Most statements have only one line. With languages whose lines are delimited by semicolons, the programmer pays a tax every line, just so that multiline statements can be used. But as presented below, Nimrod lets you use multiline statements most of the time w/o requiring this semicolon tax.
|
||||
|
||||
Really long lines that must be broken are bad style, but often unavoidable. In those cases, Nimrod provides many implicit continuation . The rule of thumb is (forgot it). If none of those things occurs naturally on your line, you can always add a parenthesis around it all. Two characters in those exceedingly rare situations, instead of one character every line.
|
||||
Really long lines that must be broken are bad style, but often unavoidable. In those cases, Nimrod provides many implicit continuation . The rule of thumb is 80 to 120 characters maximum per line. If none of those things occurs naturally on your line, you can always add a parenthesis around it all. Two characters in those exceedingly rare situations, instead of one character every line.
|
||||
|
||||
After a continuation, the code can be positioned quite freely. The only rule is that the continuing line must be indented at least one level above the first line.
|
||||
|
||||
|
@ -43,7 +43,7 @@ else
|
|||
|
||||
### Tabs vs Spaces
|
||||
|
||||
This is a non-issue in Nimrod, as it only accepts spaces for indenting and will fail at compile time if it detects any problem (though you can trivially make a source code filter to convert your tabs to spaces, if you really prefer them). However, languages that allow both of them to be mixed are dangerous. Some languages, like python 2 by default (fixed on python 3), tries to convert a tab to a certain number of spaces, and thus an indentation error introduced by mixing tabs and spaces will only be detected as a run-time failure. Other languages, that ignores any type of indentation, will generate code that behaves differently than it looks at first sight when using an editor with different tab-stops configuration. This can hide/introduce bugs, like in the previous C/C++ example.
|
||||
This is a non-issue in Nimrod, as only spaces are accepted as an indentation character - a syntax error will be thrown if the compiler detects tabs being used for indentation (though this can be worked around by using a (link here w/ text "syntax filter"). However, languages that allow both of them to be mixed are dangerous. Some languages, like python 2 by default (fixed on python 3), tries to convert a tab to a certain number of spaces, and thus an indentation error introduced by mixing tabs and spaces will only be detected as a run-time failure. Other languages, that ignores any type of indentation, will generate code that behaves differently than it looks at first sight when using an editor with different tab-stops configuration. This can hide/introduce bugs, like in the previous C/C++ example.
|
||||
|
||||
|
||||
### Sharing code
|
||||
|
|
Loading…
Reference in New Issue