Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: REMATCH_PCRE with zsh built without pcre support



On Apr 4, 12:36am, Daniel Shahaf wrote:
}
} The question is just what should the failure mode be when
} zsh/pcre _should_ have been loaded, but [due to a bug in the user's
} script] hadn't been.  Should errflag be set once REMATCH_PCRE is set,
} or at the first affected use of =~ ?

You're correct that this is the question posed at the start of this
thread, but it's not the question I want to answer.

The question I want to answer is:  Given that the only reasonable time
to set errflag is at the first affected use of =~ , does that make the
present behavior (i.e., no error) of setopt REMATCH_PCRE so egregiously
wrong that we should get rid of the option itself?

My own answer is "no," but I'm willing to entertain counter-assertions.

I'm also willing to entertain "oh, well, who cares if we muck up the
code a bit more with a module-specfic hack in options.c, let's have
an error at an unreasonable time." I don't think it's a good idea, but
there have been worse ones.

} That's not a trivial question, but the point I was trying to make in my
} previous post is that, while both of us might prefer [for different
} reasons] that REMATCH_PCRE had never been added, we can't just remove it

Certainly one approach would be to always use pcre when it is loaded, and
always use regex when it is not, and only throw an error when neither of
them is available.  That would only introduce a problem if someone is
expecting regex semantics out of a pattern that is valid in both cases
but means something else in pcre semantics.  I'm not going to give myself
a headache trying to construct an example.

} Apologies if I've tested your patience, that wasn't my intention.

*You* are not who/what's testing my patience, and it wasn't my intent to
give you that impression.

If we go with the module-specific hack in options.c, we should also have
an option-specific hack in Modules/pcre.c so "zmodload -u zsh/pcre" is
an error when REMATCH_PCRE is set.  Enforced dependence cuts both ways.



Messages sorted by: Reverse Date, Date, Thread, Author