[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How many spaces a tab is worth

This page is part of the web mail archives of SRFI 49 from before July 7th, 2015. The new archives for SRFI 49 contain all messages, not just those from before July 7th, 2015.

I suggest this model for comparing indentation of lines L1 and L2.

TAB is only allowed at the beginning of a line.
Assume line L1 starts with T1 tabs followed by S1 spaces,
and line L2 starts with T2 tabs followed by S2 spaces.
For the indentation of L1 and L2 to be comparable, either:
(= T1 T2), in which case compare S1 and S2; or:
(and (zero? S1) (zero? S2)), in which case compare T1 and T2.
Other case are erroneous, since we cannot consistently
compare them.

Furthermore, in the case (= T1 T2), if either (= S1 (+ S2 1))
or (= (+ S1 1) S2) that case is also erroneous, since a difference
of a single space is too likely to be a typo.
	--Per Bothner
per@xxxxxxxxxxx   http://per.bothner.com/