develooper Front page | perl.perl5.porters | Postings from October 2011

Re: We need to consider Unicode variable names for 5.16

Thread Previous | Thread Next
From:
John Imrie
Date:
October 15, 2011 02:42
Subject:
Re: We need to consider Unicode variable names for 5.16
Message ID:
4E99556D.5010704@virginmedia.com
On 15/10/2011 04:20, Brian Fraser wrote:
>
>     1) Individual scripts and packages may be in any normalisation
>     form but identifiers will be compared in a known way
>
> So, store them in NFC, but compare them using whatever form the 
> package is in? I assume it's doable, but that would mean a performance 
> hit (on stash lookup, you'd have to normalize not only the key, but 
> also every single entry in the stash), so I'm not sure if it's desirable.
If you are using Unicode in your identifiers you are going to have to 
accept some trade offs. But I was thinking that we would only do the 
normalization under the pragma and under the pragma we can expect 
normalized identifiers. If, as I propose below, we do a 'use feature' 
this might help to limit the scope of when we normalise to only code 
that expects/ wants it.
>
> Meanwhile, -if- we can settle on one normalization form to use (NFC, 
> NFC! :), and have a pragma apply that and only that, then this all 
> becomes a lot less complex. Sure, it's still opt-in, but there's a lot 
> less edge cases. Anyone? : (
>
>         2) Anything not using utf8 will still be backwardly compatible.
>
> Eh, that's still problematic. 'use utf8;' should mean that your source 
> is in utf8, and nothing more. Having it change under your feet means 
> that $\N{LATIN SMALL LETTER A WITH ACUTE} and $a\N{COMBINING ACUTE 
> ACCENT} would work differently, and without warnings, depending on 
> your version of Perl.
You have convinced me that use utf8 was a bad idea. So something like 
use feature 'normalise_identifiers'; would be preferable.

John


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