develooper Front page | perl.perl5.porters | Postings from June 2019

[perl #134146] \p{user-defined} should be immune from later Unicodereleases

From:
Karl Williamson via RT
Date:
June 3, 2019 03:29
Subject:
[perl #134146] \p{user-defined} should be immune from later Unicodereleases
Message ID:
rt-4.0.24-13627-1559532570-44.134146-15-0@perl.org
On Fri, 31 May 2019 21:41:45 -0700, public@khwilliamson.com wrote:
> On 5/27/19 2:48 PM, J Greely via RT wrote:
> > My program (which worked from at least 5.10.1 through 5.20.2) did
> > indeed reference "/^\p{InKana}+$/" before defining "sub InKana
> > {...}". It feels very un-Perly to have to put a sub at the top of
> > your script in order to get correct behavior, so I'd agree that the
> > documentation needs an update.
> >
> > ---
> > via perlbug:  queue: perl5 status: open
> > https://rt.perl.org/Ticket/Display.html?id=134146
> >
> 
> You have convinced me, without perhaps intending to, that this is a
> bug.
>   I'm working on a fix so that user-defined subs always override an
> official property.

It turns out that this particular instance is symptomatic of another problem.  The 'In' prefix is only supposed to be used for Block properties.  But it was being accepted for all.  This bug has apparently been there from the beginning of such things.

That issue has been fixed by 74333e98d322c14118a2c17040aba2c17c0b2152, which means no documentation should be changed.

The bottom line is that later Unicode releases with their new property names should not override existing code that uses a particular user-defined property name.  I have changed the title of this ticket accordingly.

And it turns out that there is a fairly simple solution that does this.  That is to never expand until runtime a property whose name could be a user-defined one.  If at that time no appropriate sub has been defined, then look for an official properlty with that name.

This means slower execution if and only if the property name begins with In or Is  but only the first time the match is tried.

I will defer fixing this for the time being.
-- 
Karl Williamson


---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=134146



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