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

Re: spaces and tabs confused?

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



David Vanderson:

> For example, if your editor had a tab-width of 2:
> 
> [tab][space][space]define foo()
> [space][space][tab]  "bar"
> 
> My reading of the spec says this would be an error, but it would be 
> especially difficult to understand, because there's no visual 
> difference.  Am I missing something, or has this already been discussed 
> elsewhere?

Your reading is correct, the spec defines that as an error.

I don't think it's hard to understand, though.
You're right that it would *look* the same, but it's easily
detected and diagnosed at read time.  For example,
the reference implementation produces this error message
on receiving the second line:
  Error: Inconsistent indentation

That's a fairly specific error message.  If you don't think that's
clear enough, we could even modify it further to identity exactly
what was different, e.g.:
  Error: Inconsistent indentation between '\x09  ' and '  \x09'

What worries me are common, easily-made errors that a reader or interpreter
*cannot* detect.    This isn't the case at all; just like ")" with no matching "(",
this is easily detected and diagnosed.

--- David A. Wheeler