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

[email protected] (karl williamson)
Newsgroups perl.perl5.porters
Message-ID <[email protected]>
Abigail wrote:
> On Fri, Jun 04, 2010 at 07:45:36AM -0600, karl williamson wrote:
>> Abigail wrote:
>>
>> 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?
> 
> 
> IMO, no. It doesn't now, and it's too easy to generate false warnings.
> I also think it's very less likely to make a hexadecimal-instead-of-octal
> error, then a digital-instead-of-octal error. After all, for most people
> digital is what they've learned early in life. As Nick said, warning on
> \08 makes sense, as it may happen because someone added 1 to \07, forgetting
> about the octal issue. 
> 
> Heck, we don't even warn (and we shouldn't start now, I may add) on /\xabc/.
> 
> 
> Abigail
> 

OK.  I think we have agreement.  I'll recap to give people another 
chance to disagree, but first, am I overlooking something if I change 
the docs to say that using 3 digits always for \OOO causes the 
ambiguities to completely go away, including concatenation of strings to 
form larger patterns, as long as there are fewer than 64 (= \100) 
capture groups?

So here's what I'm planning:

Existing Behavior Changes
   [\8\9] will mean [89] instead of [89\000].  	
   The current wrong warning "Illegal octal digit
   ignored" will change to "Unrecognized escape"

   \400 and above in one context now generates a
   deprecated message and is taken modulo \400.
   It wil will now mean \x{100} and above, with
   no warning.  This matches behavior in all other
   places except -0 on the command line.

   \o{...} will now generate an octal constant
   instead of the literal o{...} and the
   "Unrecognized escape" warning on the 'o'

   \o not followed by a { will now be a syntax
   error instead of "Unrecognized escape" warning
   on the 'o'

Additional warning message changes
   \08 \009 will generate a new message instead of
   the existing wrong "Illegal octal digit ignored".
   I'm thinking: "Too few digits in octal character
   constant; assuming you meant '\\%04d'".

Documentation will be updated, including saying that -0400 and above on 
the command line means the same as -0777 currently does.
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.