This Month with Nim: March 2023
nim-lang.org
nim-lang.org
Spacing and Whitespace Conventions
Lines should be no longer than 80 characters. Limiting the amount of information present on each line makes for more readable code - the reader has smaller chunks to process.
Two spaces should be used for indentation of blocks; tabstops are not allowed (the compiler enforces this). Using spaces means that the appearance of code is more consistent across editors. Unlike spaces, tabstop width varies across editors, and not all editors provide means of changing this width.
Nim's standard grammar describes an indentation sensitive language. This means that all the control structures are recognized by indentation. Indentation consists only of spaces; tabulators are not allowed.
The indentation handling is implemented as follows: The lexer annotates the following token with the preceding number of spaces; indentation is not a separate token. This trick allows parsing of Nim with only 1 token of lookahead.
It eliminates lots of issues mixing code that has tabs or spaces like in Python. I’ve never had to worry about a lingering tab.
Is Nim requiring this at build time? If so, that would be an odd choice for a language that goes out of its way to let people call functions, capitalize variables, and manage memory however they want.
Quick someone reset the inane "Days since mentioning style insensitivity".
This lets me have context of having a test file in one column, some code in another, and the core types in another say.