develooper Front page | perl.perl5.porters | Postings from November 2014

Re: [perl #122853] Guarantee 0-9, A-Z, a-z character classes

Thread Previous | Thread Next
Karl Williamson
November 14, 2014 05:25
Re: [perl #122853] Guarantee 0-9, A-Z, a-z character classes
Message ID:
On 11/06/2014 02:42 AM, Abigail wrote:
> On Sat, Nov 01, 2014 at 09:14:33AM +0000, Ed Avis wrote:
>> Perhaps the answer is to introduce a new escape \X which is explicitly non-portable and looks up in the native character set.
>> \x and \N look up in Unicode on all platforms.
>> Mixing \X with the others in a single range is not allowed.
> Before we all go changing stuff (outlawing constructs, throwing warnings,
> change meaning, whatever else has been suggested), does anyone have to
> actual examples of code (that is, real code, not a constructed cases in
> a theoretical scenario) that doesn't behave as the programmer intended,
> and is caused by the ASCII-EBCDIC differences? Any bug reports?
> In other words, is there an actual problem that needs to be tackled?
> Abigail

On the contrary, the absence of any real-world examples would argue for 
at least a warning, as opposed to doing nothing.

First, it means that little will break should we change behavior, so 
it's pretty safe to do so.

Second, it also means that people don't tend to do this in real life, 
and so when it happens, it is likely to be a mistake rather than 
intentional, hence a likely bug that the programmer should be warned 
about.  There are people with time to kill that don't want their 
mistakes pointed out sooner rather than being bitten by them later, but 
the vast majority of programmers aren't like that.

As I said, the only instances in cpan of using \N{} in a range have both 
ends be \N{}.

Note also that recently a [A-z] was introduced into blead.  And it was a 
typo, not the intent of the programmer.  I think that people don't tend 
to think in such ranges, so when found, it's much more likely to be a 
mistake, worthy of warning about.

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