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

Interpolating a Hash in a regex treats it as a list and errors out #6217

Closed
p6rt opened this issue May 2, 2017 · 5 comments
Closed

Interpolating a Hash in a regex treats it as a list and errors out #6217

p6rt opened this issue May 2, 2017 · 5 comments
Labels
regex Regular expressions, pattern matching, user-defined grammars, tokens and rules

Comments

@p6rt
Copy link

p6rt commented May 2, 2017

Migrated from rt.perl.org#131243 (status was 'rejected')

Searchable as RT131243$

@p6rt
Copy link
Author

p6rt commented May 2, 2017

From @zoffixznet

Both of these forms produce the error below

  my %stuff = <fo ba me ow>;
  say 'foo bar meows' ~~ m​:g/ %stuff \S+ /;
  say 'foo bar meows' ~~ m​:g/ %(<fo ba me ow>) \S+ /;

  # P6opaque​: no such attribute '$!reified' in type List when trying to get
  # a value in block <unit> at z2.p6 line 8

What did I expect to happen? No idea, I just randomly tried the code. If it's not meant to work then at least a better error should be shown.

@p6rt
Copy link
Author

p6rt commented Dec 29, 2017

From @smls

On Tue, 02 May 2017 08​:35​:34 -0700, cpan@​zoffix.com wrote​:

Both of these forms produce the error below

my %stuff = <fo ba me ow>;
say 'foo bar meows' ~~ m​:g/ %stuff \S+ /;
say 'foo bar meows' ~~ m​:g/ %(<fo ba me ow>) \S+ /;

# P6opaque​: no such attribute '$!reified' in type List when trying to
get
# a value in block <unit> at z2.p6 line 8

What did I expect to happen? No idea, I just randomly tried the code.
If it's not meant to work then at least a better error should be
shown.

S05 says¹​:

  The use of a hash variable in patterns is reserved.

So yes, this should be made to throw a nicer error.


[1] http://design.perl6.org/S05.html#Variable_(non-)interpolation

@p6rt
Copy link
Author

p6rt commented Dec 29, 2017

The RT System itself - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Jan 5, 2018

From @zoffixznet

This got re-reported on GitHub. Closing in favour of that Issue​: rakudo/rakudo#1367

@p6rt
Copy link
Author

p6rt commented Jan 5, 2018

@zoffixznet - Status changed from 'open' to 'rejected'

@p6rt p6rt closed this as completed Jan 5, 2018
@p6rt p6rt added the regex Regular expressions, pattern matching, user-defined grammars, tokens and rules label Jan 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
regex Regular expressions, pattern matching, user-defined grammars, tokens and rules
Projects
None yet
Development

No branches or pull requests

1 participant