[nim-dev] Re: Tabulation symbols not allowed

  • From: OderWat <nimforum@xxxxxxxxxx>
  • To: nim-dev@xxxxxxxxxxxxx
  • Date: Thu, 8 Sep 2016 10:39:02 +0000

Allowing tabs means "allowing mixed" because TABs are what the are. They are 
not "4 spaces in the package of one \t" they are meant as stops at fixed 
positions starting from 0 and if you use a Tabstop of 4 and you use indentation 
of 2 you will have 1 Tab and two spaces in front of your text.

Allowing ``\t`` to let uses choose how their indentation width is, makes 
probably sense if you only allow tabs and no spaces but not if you allow both 
(mixed or not).

So if you really want to allow tabs the Nim compiler needs to know the tab 
width intended to be used. This would complicate the parser I guess but would 
be possible as preprocessor which converts the given tab size to spaces before 
continuing with compilation. That would be even transparent imho (as for 
example the columns position would stay the same for error reporting).

To me this boils down that there could be a source-code-filter which gets a 
tab-size and does the correct tab transformation on the source. This way 
everybody who wants can use tabs in his sources and Nim itself does not need to 
change anything besides the inclusion of such filter.

I guess a PR would maybe go through :)



Other related posts: