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

Mention of $0 before match yields strange error in rakudo #222

Closed
p6rt opened this issue Aug 9, 2008 · 4 comments
Closed

Mention of $0 before match yields strange error in rakudo #222

p6rt opened this issue Aug 9, 2008 · 4 comments

Comments

@p6rt
Copy link

p6rt commented Aug 9, 2008

Migrated from rt.perl.org#57758 (status was 'resolved')

Searchable as RT57758$

@p6rt
Copy link
Author

p6rt commented Aug 9, 2008

From @masak

r30136​:
$ ./perl6 -e '$/' # works

$ ./perl6 -e '"hi" ~~ /(i)/; $0' # works

$ ./perl6 -e '$0' # fails (in a strange way)
get_pmc_keyed() not implemented in class 'Undef'
[...]

I don't know whether the failure should eventually be silent or loud,
but I'm pretty sure it shouldn't involve get_pmc_keyed().

It clearly has something to do with indexing, since $0 is essentially
sugar for $/[0]. The same problem reoccurs when indexing other,
non-special scalars​:

$ ./perl6 -e 'my @​a; @​a[0]' # works

$ ./perl6 -e 'my $a; $a[0]' # same problem
get_pmc_keyed() not implemented in class 'Undef'
[...]

Perl 5's motto here seems to be complaining as little as possible.

$ perl -Mstrict -we 'my $a; $a->[0]'
Useless use of array element in void context at -e line 1.
$ perl -Mstrict -we 'my $a; my $b = $a->[0]'
$ perl -Mstrict -we 'my $a; print $a->[0]'
Use of uninitialized value in print at -e line 1.

@p6rt
Copy link
Author

p6rt commented Dec 13, 2008

From @pmichaud

Now fixed in r33865, thanks!

Pm

1 similar comment
@p6rt
Copy link
Author

p6rt commented Dec 13, 2008

From @pmichaud

Now fixed in r33865, thanks!

Pm

@p6rt
Copy link
Author

p6rt commented Dec 13, 2008

@pmichaud - Status changed from 'new' to 'resolved'

@p6rt p6rt closed this as completed Dec 13, 2008
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant