Re: What should /\08/ match and do?
[email protected] (karl williamson)
| Newsgroups | perl.perl5.porters |
|---|---|
| Message-ID | <[email protected]> |
Nicholas Clark wrote:
> On Tue, Jun 01, 2010 at 01:13:33PM +0200, Abigail wrote:
>> On Fri, May 28, 2010 at 10:16:59AM -0600, karl williamson wrote:
>>> I thought I knew the answer to this, but am now not so sure.
>>>
>>> I thought it should match a NUL followed by a digit 8. That is what it
>>> does now, although it raises the false error message "Illegal octal
>>> digit '8' ignored". This is false because it isn't ignored.
>>>
>>> I thought I would just silence the message; but it occurs to me that it
>>> would be very unlikely for someone to want to match a NUL followed by
>>> anything else; or is that my C-centric thinking? /\0A/ matches NUL
>>> followed by A with no message.
>>>
>>> Anyway I'd see if someone else had any opinions on this.
>>
>> I think /\08/ should match NUL followed by 8. I do not know what else
>> it should match, and just giving up and refusing to do anything because
>> the programmer might have meant something else seems very unPerlish to me.
>>
>> I agree the warning could use some rewording though. Perhaps a "/\08/
>> interpreted as /\x{00}8/" kind of warning, but that may not be as easy
>> as it sounds.
>
> I'm with Abigail in that I don't think that it should be silent, as there's
> a latent bug if \07 is edited to \08, or vice versa.
>
> Nicholas Clark
>
What about \008 ? The pods say that a two or three digit octal number
follows a backslash, but it turns out that a single digit "works" in
character classes, eg. [\7]
What about \x{} ? It currently yields \000 silently. I originally
proposed deprecating it, but this met objections, but I do think it
should warn, even if not deprecated.
\N{} yields two errors, one correct, one misleading:
./perl -Mcharnames=:full -Ilib -E '"\N{}"'
Unknown charname '' at lib/unicore/Name.pl line 1
Deprecated character in \N{...}; marked by <-- HERE in \N{}<-- HERE at
-e line 1.
And there is:
./perl -Mcharnames=:full -Ilib -E '"\N{U+}"'
Invalid hexadecimal number in \N{U+...} at -e line 1, within string
Execution of -e aborted due to compilation errors.