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

Re: [perl #84578] Bug report: error with \L, \l, \U and \u operators

Thread Previous | Thread Next
Karl Williamson
August 15, 2016 19:00
Re: [perl #84578] Bug report: error with \L, \l, \U and \u operators
Message ID:
On 08/15/2016 10:40 AM, Dan Collins via RT wrote:
> On Tue Feb 22 02:31:59 2011, wrote:
>>> print "\L\udD\n";   # Dd    It seems, first works \L, then \u. I
>>> think, it's a bug!
>> I tend to agree. I'd expect it to be equivalent to
>> lc ucfirst "dD";
>> But there's the "left to right" statement. Whatever that means.
>>> print lc "\udD\n";  # dd    Yes, the result differ from previous
>>> line!
>> That appears to be inconsistent with "\L\udD\n";
>>> print "\L\Ua\n";    # Syntax error, oops!
>>> print "\U\La\n";    # Syntax error
>>> print "\L\La\n";    # Syntax error
>> That's just plain weird, IMO.
>> Abigail
> This is profoundly strange, and is still in blead as described above. Precedence issues aside, I think that "\L\udD" should eq "dd", and "\L\UdD" should also eq "dd" (and in any event should be valid syntax). I thought I understood how these parsed after digging into the other precedence ticket out there, but evidently I do not.

The whole thing is broken.  I'm not sure I agree with your assessment.

IIRC we decided that someone would look thoroughly at the situation and 
come back with a proposal.  I thought demerphq was doing it, and he 
thought I was doing it, and we both hoped someone else would do it.  And 
there it remains.

In thinking about it lately, I:

a) wonder if we should create a single ticket for this, including \Q, 
and merge all the other tickets into it.

b) note that the regex pattern results diverge from the double-quoted 
string results, and the latter is more sane; so that the regex code 
should be made to work more like the double-quoted code.

$ blead -le 'print qr/\L\ABCD/'

silently turns what probably was meant to be the assertion \A into a 
BELL character.

$ blead -le 'print "\L\ABCD"'
Unrecognized escape \A passed through at -e line 1.

acts like what I consider sanely, as does this:

$ blead -le 'print "\l\ABCD"'
Unrecognized escape \A passed through at -e line 1.

but I don't know about  this:

blead -le 'print qr/\l\ABCD/'

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