develooper Front page | perl.perl5.porters | Postings from May 2016

Re: [perl #128213] No deprecation warning on literal left curlybracket in /.{/ etc

Thread Previous | Thread Next
May 24, 2016 19:30
Re: [perl #128213] No deprecation warning on literal left curlybracket in /.{/ etc
Message ID:
Tom Wyant via RT wrote:
>Karl's addition of "... and not after an assertion" makes sense to
>me on the face of it, since it makes no sense (to me) to quantify an
>assertion. If ^ matches once at a given location, it will match any
>number of times.

That would make some sense if such a rule were being added, but it's not.
/\A/ is such an assertion, and everything you say about /^/ applies
equally to /\A/.  Yet /\A{/ has been deprecated at the same time as /x{/.
There is no exception to the deprecation for assertions.

If assertions were a consistent exception, I'd still be opposed to that.
They're not an exception to quantifier syntax: /\A{3}/ is a quantified
assertion, as is /^{3}/.  We also don't have that kind of contextual
exception for other metacharacters.  /*/ is an error, even though by your
logic the "*" can't possibly be intended as a quantifier because it's
at the beginning of the pattern.  /[/ is an error, even though without a
"]" it can't possibly be interpreted as a character class.

>"Always removed" is certainly trivial, but "removed except at the
>beginning of a group and after an assertion" is not much harder.

The reality is harder than either.  Implementing whatever it is isn't
going to be difficult, but finding out what it is *is*.  We should make
the reality as simple as possible, to make it as easy as possible for
programmers to know it accurately.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About