[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Ignoring space changes, but not all space changes

From: Julian Foad <julianfoad_at_btopenworld.com>
Date: 2006-02-16 23:27:34 CET

kfogel@collab.net wrote:
>
> I think this misses the main case for ignoring whitespace changes. In
> many formats, changes in the "nonzero amount" of whitespace are
> insignificant, but changes in the *presence* of whitespace are
> significant. In other words
>
> foo bar
> foo bar
> foo bar
>
> are often semantically all the same, but completely different from
>
> foobar

Ah, but that's only true when the characters on either side concatenate into a
single token.

   f ( - - x )

is equivalent to

   f(- -x)

but they differ from

   f (--x)

> This distinction corresponds to the GNU diff -b and -w options. [...]

Neither of those actually does what we want. Ignoring all space is unsafe,
whereas ignoring changes to existing space is safe but incomplete (it wouldn't
be any use on the recent reformatting).

In languages like C, what we need is:

   Ignore spaces completely when they're between tokens that don't concatenate;
   ignore changes to the nonzero amount of space where tokens do concatenate.

The sets of tokens that do and do not concatenate are language-specific.

> This is not really language-specific -- it's common to so many formats
> as to be generally useful & deserving of native support, IMHO.

I'm pretty much resigned to having these basic options because they are better
than nothing when used with a bit of human-brain filtering and luck, but they
don't really cut the mustard as tools for the job.

- Julian

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Thu Feb 16 23:37:06 2006

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.