develooper Front page | perl.perl5.porters | Postings from April 2017

Re: [perl #128420] Changes in regex recursion in 5.24

Thread Previous | Thread Next
From:
demerphq
Date:
April 12, 2017 07:39
Subject:
Re: [perl #128420] Changes in regex recursion in 5.24
Message ID:
CANgJU+Wpm0HDAGFs2Lp49oxgPnRd0L40PNMY2FP25DRTrEqGkw@mail.gmail.com
On 12 April 2017 at 08:02, Jan Goyvaerts <jg@jgsoft.com> wrote:
> Karl Williamson wrote:
>
>> The single letter constructs, which you assume are meant to be Posix
>> classes, don't warn, as none of them are close enough to a legal class
>> name that they could have been intended to be one.
>
> Dinkumware's implementation of std::regex (and possibly other
> implementations) support [:w:], [:s], and [:d:] as shorthands for [:word:],
> [:space:], and [:digit:].

Do you know why? Do they not support \w \s and \d?

> Boost::regex additionally supports [:v:] and [:h:] to match vertical and
> horizontal whitespace.

I dont think we handle POSIX charclasses very cleanly. We warn about
misplaced "^" negation, but we dont warn about mistyped POSIX names,
which means we have not properly reserved the POSIX namespace for our
own use, and we let people typo themselves into incorrect matches. IMO
silently treating a typoed POSIX charclass as its constituent
characters is an insidious thing to do.

1. I think in the next release we should produce a deprecation warning
when we see anything that is POSIX-char-class-like but which is
invalid.

2. Then in a release or so afterwards we could make them errors.

3. Then in a release or so after that we could add support for these
short forms if we wanted.

IMO, even if we dont do step 3 we should step 1 and 2.

Yves


-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About