Re:This Month with Nim: March 2023
by 000ooo000 on Thursday April 06, 2023 @08:24PM
(#35476451)
Their rationale for enforcing spaces over tabs is nonsense, particularly after you dive through their GH issues, find where this is discussed, and see the true reason is implementation simplicity.
[ Parent
| on HN ]
Re:This Month with Nim: March 2023
by otherme123 on Friday April 07, 2023 @09:52AM
(#35481554)
Implementation simplicity also sounds good to me. BTW, it's discussed in the manual:
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.
Only allowing spaces was a good decision. It was supposedly inspired by a quote from Guido bin Rossum that if he could redo it he’d only allow spaces in Python, or something along those lines.
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.