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

A hole in $/.list is a Mu, but a hole in @a.List is a Nil / null object error #2076

Open
zoffixznet opened this issue Jul 15, 2018 · 1 comment
Labels
consensus needed Needs a well-versed decision with justification, possibly from a core developer

Comments

@zoffixznet
Copy link
Contributor

zoffixznet commented Jul 15, 2018

IMO that Mu should be a Nil as well, as many routines don't take a Mu and so working with bare Mu is painful. In fact, if you index into that element, you get a Nil instead of a Mu

<Zoffix_> m: my @a = ^5; @a[2]:delete; dd @a.List
<camelia> rakudo-moar ecbf44fb5: OUTPUT: «(0, 1, Nil, 3, 4)␤»
<Zoffix_> m: "ac" ~~ /(.)(.)?(.)/; say $/.list
<camelia> rakudo-moar ecbf44fb5: OUTPUT: «(「a」 (Mu) 「c」)␤»
<Zoffix_> m: "ac" ~~ /(.)(.)?(.)/; say $/.list[1]
<camelia> rakudo-moar 0a32c6212: OUTPUT: «Nil␤»

Also, looks like it doesn't even get hllized in some cases:

<Zoffix_> m: "ac" ~~ /(.)(.)?(.)/; for $/.list { .say }
<camelia> rakudo-moar 0a32c6212: OUTPUT: «「a」␤Cannot call method 'say' on a null object␤  in block <unit> at <tmp> line 1␤␤»
zoffixznet added a commit to Raku/roast that referenced this issue Jul 15, 2018
…ptures in the middle"

This reverts commit 581b553.

IMO it should not be a Mu in that hole. Filed as
R#2076 rakudo/rakudo#2076
@zoffixznet
Copy link
Contributor Author

zoffixznet commented Jul 15, 2018

FYI: this started off from review of the test for RT#129299 that adds a proptest I committed in 2016 for a Mu in there.

I disagreed with 2016-Zoffix and threw out that test. It should be placed back (in potentially modified form) to re-cover RT#129299.

# RT #129299
subtest '$/.list returns all items even with optional captures in the middle', {
    "ac" ~~ /(.)(.)?(.)/;
    my ($one, $two, $three) = $/.list;
    is $one,       'a',  'first item';
    is $two.^name, 'Mu', 'second item'; # can't use is-deeply to test for Mu's
    is $three,     'c',  'third item';
}

@zoffixznet zoffixznet changed the title A hole in $/.list is a Mu, but a hole in @a.List is a Nil A hole in $/.list is a Mu, but a hole in @a.List is a Nil / null object error Jul 15, 2018
@zoffixznet zoffixznet added the consensus needed Needs a well-versed decision with justification, possibly from a core developer label Sep 17, 2018
ugexe pushed a commit to Raku/roast that referenced this issue Dec 15, 2018
…ptures in the middle"

This reverts commit 581b553.

IMO it should not be a Mu in that hole. Filed as
R#2076 rakudo/rakudo#2076
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
consensus needed Needs a well-versed decision with justification, possibly from a core developer
Projects
None yet
Development

No branches or pull requests

1 participant