Matt Wozniski wrote:

> On Thu, Mar 27, 2008 at 2:47 PM, Bram Moolenaar wrote:
> >  Xiaozhou Liu wrote:
> >
> >  > During the development of the new regexp, one thing confuses me a lot:
> >  > ordered alternation. (e.g. given r.e. 'ab\|abc' and text 'abc', 'ab'
> >  > matched, not 'abc')
> >  >
> >  > I know that 100% compatibility is one of the project goals. So I try
> >  > to keep this feature
> >  > in the new regexp. But the problem is, ordered alternation is kind of
> >  > 'side effect'
> >  > of the original back track regexp matcher. AFAIK, It is very hard to
> >  > implement this
> >  > feature in the new, truly NFA matcher, if it is not impossible. We can 
> > resort
> >  > to the original regexp when we see '\|',  but we don't solve the
> >  > problem perfectly.
> >  >
> >  > So does anyone really need this feature to be kept? If so, please do 
> > tell me.
> >  > For me, the removal of this 'feature' won't break anything.
> >
> >  It is close to impossible to check that a change like this doesn't break
> >  existing scripts.  And when something breaks, e.g. a syntax file, a
> >  normal user is very unlikely to be able to figure out what caused the
> >  problem.
> >
> >  I stick to the opinion that the new regexp engine must work exactly
> >  like the existing one.  Most things can be made to work that way.  I
> >  also thought that this behavior of an alternate branch could be made to
> >  work in a DFA, with some effort.  And otherwise we would have to fall
> >  back to the old engine when there is an alternate branch in the regexp.
> 
> For what it's worth, I disagree strongly.  This behavior is nothing
> but a bug in the existing implementation - a documented bug, but a bug
> nonetheless.

I don't see why one would call this a bug.  It's works this way
intentionally.

> In this particular case, I definitely think that we
> should strive for compatibility with other regex engines, rather than
> backwards compatibility with older vim versions.  And, since this new
> regex engine would likely not be introduced until vim 8.0, there is no
> better time to break backwards compatibility.  Since the old guarantee
> that the leftmost alternation is matched first in fact makes regexes
> work differently than in Perl, and in every POSIX implementation, and
> make a DFA-based regex engine harder to write, I think we should
> consider them as a historical fluke, and any syntax files that rely on
> them to have been too cozy with the current engine.  We should
> re-write such syntax files, rather than keep a useful improvement out
> of vim for their sake.

No, backwards compatibility is more important.  I don't want a newer
version of Vim not being used because it breaks something that people
can't figure out.  A jump from 7.x to 8.x doesn't mean it's allowed to
break things.

Considering the recent OOXML fuzz I have lowered my appreciation for
standards considerably.

The Vim regexp engine isn't conforming to a standard and doesn't work
like any other engine anyway, so I see no reason to make a detail work
that way.  It still will work quite different from other engines.

-- 
hundred-and-one symptoms of being an internet addict:
189. You put your e-mail address in the upper left-hand corner of envelopes.

 /// Bram Moolenaar -- [EMAIL PROTECTED] -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\        download, build and distribute -- http://www.A-A-P.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_dev" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Raspunde prin e-mail lui