From: Tay Ray Chuan Date: Thu, 12 Jan 2012 00:52:49 GMT Subject: Re: [PATCH 2/2] diff --word-diff: use non-whitespace regex by default Message-ID: In-Reply-To: <87lipexawp.fsf@thomas.inf.ethz.ch> Hi, Thomas, first off, thanks for looking through this. On Thu, Jan 12, 2012 at 4:05 AM, Thomas Rast wrote: > Tay Ray Chuan writes: > >> Factor out the comprehensive non-whitespace regex in use by PATTERNS and >> IPATTERN and use it as the word-diff regex for the default diff driver. > > Why? > > I seem to recall that the motivation for keeping the original code as-is > instead of just emulating its behavior with a default regex was that it > is faster.  So disabling the default mode should at least have an > advantage? > > If you're talking about speed, yeah, that's probably true. But I think it's worthwhile to trade-off performance for a sensible default. Something like matrix[a,b,c] matrix[d,b,c] gives matrix[[-a-]{+d+},b,c] and when we have ImagineALanguageLikeFoo ImagineALanguageLikeBar we get ImagineALanguageLike[-Foo-]{+Bar+} (But I cheated. Foo and Bar have no common characters in common; if they did, the word diff would be messy.) Both of which seem sensible. From a usability/effectiveness standpoint, I think it's more useful than what the current word-diff defaults to - the whole line is taken as a "word", with the pre-image shown as deleted and the post-image as added; we don't even try to run LCS on it. Examples are lifted from: [1] http://article.gmane.org/gmane.comp.version-control.git/105896 [2] http://article.gmane.org/gmane.comp.version-control.git/105237 -- Cheers, Ray Chuan