Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backslashed digits in character classes are inconsistent (/ <[\5]> /) #5981

Open
p6rt opened this issue Jan 5, 2017 · 1 comment
Open

Backslashed digits in character classes are inconsistent (/ <[\5]> /) #5981

p6rt opened this issue Jan 5, 2017 · 1 comment
Labels

Comments

@p6rt
Copy link

p6rt commented Jan 5, 2017

Migrated from rt.perl.org#130508 (status was 'new')

Searchable as RT130508$

@p6rt
Copy link
Author

p6rt commented Jan 5, 2017

From @AlexDaniel

First, two examples​:

Code​:
say “5” ~~ /<[\5]>/

Result​:
「5」

Code​:
say “0” ~~ /<[\0]>/

Result​:
Nil

Why? Because backslashed zero stands for a null byte​:

Code​:
say “\0” ~~ /<[\0]>/

Result​:
「␀」

The fact that some backslashed digits do one thing and others do something else is inconsistent by itself.

However, we might also look at the behavior elsewhere​:

Code​:
say “2” ~~ / \2 /

Result​:
===SORRY!=== Error while compiling -e
Unrecognized backslash sequence (did you mean $1?)
at -e​:1
------> say “2” ~~ / \2⏏ /

Code​:
say “2” eq “\2”

Result​:
===SORRY!=== Error while compiling -e
Unrecognized backslash sequence (did you mean $1?)
at -e​:1
------> say “2” eq “\2⏏”

If we cannot recognize this backslash sequence, let's not recognize it everywhere?

@p6rt p6rt added the at_larry label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant