Friday, April 15, 2016

Re: RFE: support POSIX standard and developing RE's

On 15 April 2016, Erik Christiansen <dvalin@internode.on.net> wrote:
> On 14.04.16 18:00, LCD 47 wrote:
> >
> > As for Vim: its regexes have features not present in any other
> > language. People use them, and thousands of plugins and syntax
> > files rely on them. You're asking to break all of them because you
> > _prefer_ something else?
>
> Please quote a whole message where I have done anything remotely like
> that. (Nothing out of context, please.) My proposed renovation was
> careful to avoid _any_ impact on existing uses, but providing POSIX
> only as a compile option - i.e. totally unseen by unenthused users.
> (Last two paragraphs of my first post on this thread.)
[...]

Oh, you didn't state it explicitly, you just aren't thinking things
to their last consequences. To spell it out for you:

(1) You can't change the syntax for / and s/// because that would break
just about every script out there.

(2) You can't add an _option_ to change the syntax for / and s/// on the
fly either, because all scripts out there would have to be aware of
the new option.

(3) This leaves you with adding new commands, that would do / and s///
with a different regex syntax. However, all !@#$... keys are
already taken, and are widely in use by other thousands of scripts.

(4) Which means you'd have to implement new / and s/// as : commands.
However, you already have :perldo and :pydo for that, yet nobody
seems to be in a hurry to write wrappers for them as replacement for
/ and s///.

Now, why would (4) be. Because nobody can think of any reasonable
user interface for it? Not really, Tim Pope's "abolish" has a :S///
command:

https://github.com/tpope/vim-abolish

Then perhaps because the existing regexes are actually usable after
all, despite being weird at first?

I'm just scratching the surface here. Something that neither you
nor any of the other proponents of improved regex engines seem to see is
that s/// is actually _very_ different from search alone. There are a
zillion of libraries for regex search (all slightly incompatible to one
another, by the way), but none for search and replace. Sure, they all
have APIs that allow in principle to implement replacing, but the common
APIs still make it very hard to have equivalents for Vim's \zs and \ze.
The closest you can get to \zs is Perl's \K, but that's quirky, and
few people trust it enough to use it. Well, if you'd dig through the
sources of Perl, Ruby, and the like, you'd eventually find out that Vim
has actually done it right, while everything else is still way behind.

Did it occur to you that what you're asking for might not actually
make as much sense as it first seems, rather than Vim developpers being
stubborn about it?

/lcd

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment