Re: What should /\08/ match and do?

[email protected] (karl williamson)
Newsgroups perl.perl5.porters
Message-ID <[email protected]>
Abigail wrote:
> On Thu, Jun 03, 2010 at 10:02:43AM -0600, karl williamson wrote:
>> I'm still digesting what people have written.  But I
>>
>> What I'm hearing is that it's not ok to add warnings on long-standing  
>> possible usages that don't make sense at least to the person proposing  
>> the message, such as me with empty {}, and Ævar with the single  
>> character sub names.  FWIW, I think that it's a mistake to not warn on  
>> using a reserved term; I don't think that putting it into the docs alone  
>> suffices.  And there would be more unhappy people when the construct  
>> they were using suddenly goes away than there would be to get a  
>> deprecation warning in advance that they are using a reserved term.
>>
>> But that's what I'm hearing.  But, Abigail originally said that it was  
>> ok for \08 to warn; and Nicholas agreed; but then I hear in the latest  
>> post on the subject from Abigail that "I'd say that pointing this  
>> potential problem out in the docs should be enough."
> 
> I made that remark regarding to the more general concatenation problem:
> 
>     $a = '(.)\1';
>     $p = qr /${a}1/;  # Equivalent to /(.)\011/
> 
> I do not think this should warn - it's not warning now, and, IMO, it's 
> uncommon enough to not introduce a new warning. [*]
> 
> The warning on use of \18 already exists - regardless whether the \18
> appears as is, or comes from a concatenation [+]. The only change I suggested
> was the wording of the warning (as the '8' isn't ignored).

OK.  What about '\0a'  It doesn't warn currently.  It is analogous to 
\08 but has a non-octal hex digit instead of a non-octal decimal digit. 
  Should it warn?

> 
>>                                                       I can go either  
>> way.  The patch I had prepared simply silenced the warning; I can add  
>> text to the documents, perhaps using his sly examples, as Yves  
>> suggested.  And I think it is a good idea to change them to stress using  
>> \g{} for backreferences.
>>
>> But I'm not sure we have consensus.
> 
> 
> [*]  Unless one can manage to have a very accurate detection - that is, 
>      concatenating a variable whose value ends in \\[0-7] with something
>      that starts with [0-7]. My worry for new warnings for existing constructs
>      is always false positives.
> 
> [+]  Although, when using C<< $a = '\1'; /${a}8/ >> Perl will warn, but
>      is likely to do what the programmer intends. Eliminating that case 
>      would be nice.
> 
> Abigail
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.