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

Internal error when a constant, unspace, and a map are involved in Rakudo #4509

Closed
p6rt opened this issue Sep 4, 2015 · 7 comments
Closed

Comments

@p6rt
Copy link

p6rt commented Sep 4, 2015

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

Searchable as RT125985$

@p6rt
Copy link
Author

p6rt commented Sep 4, 2015

From @masak

<masak_venue> hey, #perl6, I wrote this​:
https://gist.github.com/masak/b84a87a694217c9508d6

constant nums = 1, 2, 3 ... Inf;
sub replace($divisor, $word) {
-> $n { $n %% $divisor ?? $word !! $n }
}
constant fizzbuzz = nums\
.map(replace(3, "Fizz"))\
.map(replace(5, "Buzz"))\
.map(replace(15, "FizzBuzz"));
say fizzbuzz[^100];

<masak_venue> I was sad to see I got a scary exception when running it :/
<masak_venue> I think "Cannot invoke this object" in this case is at
the very least unexpected, and probably reportable as a bug
<masak_venue> ok, it happens in the first .map
<masak_venue> I've golfed it down to something that requires newlines.
<masak_venue> m​: constant nums = 1, 2, 3 ... Inf;␤constant fizzbuzz =
nums\␤ .map({ $_ %% 3 ?? "Fizz" !! $_ });
<camelia> rakudo-moar e6f360​: OUTPUT«===SORRY!=== Error while
compiling /tmp/kAAlvWKBSo␤An exception occurred while evaluating a
constant␤at /tmp/kAAlvWKBSo​:2␤Exception details​:␤ ===SORRY!=== Error
while compiling ␤ Cannot invoke this object (REPR​: Null, cs = 0)␤
at…»
<masak_venue> if I inline `nums`, the problem goes away
<masak_venue> if I remove the unspace, the problem goes away
* masak_venue submits rakudobug
<ShimmerFairy> m​: constant nums = 1; constant fizzbuzz = nums\␤.map({ $_ });
<camelia> rakudo-moar e6f360​: OUTPUT«===SORRY!=== Error while
compiling /tmp/VVtZHQ5EZS␤An exception occurred while evaluating a
constant␤at /tmp/VVtZHQ5EZS​:1␤Exception details​:␤ ===SORRY!=== Error
while compiling ␤ Cannot invoke this object (REPR​: Null, cs = 0)␤
at…»
<ShimmerFairy> masak_venue​: a bit shorter :)
<masak_venue> thank you

@p6rt
Copy link
Author

p6rt commented Sep 7, 2015

From @jnthn

Further golfs to​:

constant nums = 1; my \fizzbuzz = nums\ .map({ $_ });

But goes away with​:

constant nums = 1; my \fizzbuzz = nums\.map({ $_ });

Somehow we treat it as a sub call rather than a term when there's actually space after the \. Much odd...

@p6rt
Copy link
Author

p6rt commented Sep 7, 2015

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

@p6rt
Copy link
Author

p6rt commented Dec 3, 2017

From @AlexDaniel

Not sure how it golfs down to that, because it never produced the same error message. In any case, both issues are resolved.

First​: https://gist.github.com/76f318afe9a72a77d2bf0fecff46a555
(bisectable points at (2017-09-28) rakudo/rakudo@6824e19 but that's not really the commit that resolved the issue completely, it's a bit more complicated than that)

Second​: https://gist.github.com/Whateverable/e503d4e068d70977512a1eb47b65a0a5
(2017-10-07) rakudo/rakudo@f254e35

Tests needed for both issues.

「testneeded」

On 2015-09-07 12​:32​:06, jnthn@​jnthn.net wrote​:

Further golfs to​:

constant nums = 1; my \fizzbuzz = nums\ .map({ $_ });

But goes away with​:

constant nums = 1; my \fizzbuzz = nums\.map({ $_ });

Somehow we treat it as a sub call rather than a term when there's
actually space after the \. Much odd...

@p6rt
Copy link
Author

p6rt commented Feb 3, 2018

From @AlexDaniel

Ouch. It seems that one of my links is wrong, should've been this one I think​: https://gist.github.com/Whateverable/cedc8ef783acc22e8f07afa98f5ad7d6

On 2017-12-02 19​:41​:52, alex.jakimenko@​gmail.com wrote​:

Not sure how it golfs down to that, because it never produced the same
error
message. In any case, both issues are resolved.

First​: https://gist.github.com/76f318afe9a72a77d2bf0fecff46a555
(bisectable points at (2017-09-28)
rakudo/rakudo@6824e19
but that's not really the commit that resolved the issue completely,
it's a bit
more complicated than that)

Second​:
https://gist.github.com/Whateverable/e503d4e068d70977512a1eb47b65a0a5
(2017-10-07)
rakudo/rakudo@f254e35

Tests needed for both issues.

「testneeded」

On 2015-09-07 12​:32​:06, jnthn@​jnthn.net wrote​:

Further golfs to​:

constant nums = 1; my \fizzbuzz = nums\ .map({ $_ });

But goes away with​:

constant nums = 1; my \fizzbuzz = nums\.map({ $_ });

Somehow we treat it as a sub call rather than a term when there's
actually space after the \. Much odd...

@p6rt
Copy link
Author

p6rt commented Feb 3, 2018

From @AlexDaniel

Anyway, tests in Raku/roast@7557eef

On 2018-02-03 14​:40​:09, alex.jakimenko@​gmail.com wrote​:

Ouch. It seems that one of my links is wrong, should've been this one
I think​:
https://gist.github.com/Whateverable/cedc8ef783acc22e8f07afa98f5ad7d6

On 2017-12-02 19​:41​:52, alex.jakimenko@​gmail.com wrote​:

Not sure how it golfs down to that, because it never produced the
same
error
message. In any case, both issues are resolved.

First​: https://gist.github.com/76f318afe9a72a77d2bf0fecff46a555
(bisectable points at (2017-09-28)

rakudo/rakudo@6824e19

but that's not really the commit that resolved the issue completely,
it's a bit
more complicated than that)

Second​:
https://gist.github.com/Whateverable/e503d4e068d70977512a1eb47b65a0a5
(2017-10-07)

rakudo/rakudo@f254e35

Tests needed for both issues.

「testneeded」

On 2015-09-07 12​:32​:06, jnthn@​jnthn.net wrote​:

Further golfs to​:

constant nums = 1; my \fizzbuzz = nums\ .map({ $_ });

But goes away with​:

constant nums = 1; my \fizzbuzz = nums\.map({ $_ });

Somehow we treat it as a sub call rather than a term when there's
actually space after the \. Much odd...

@p6rt
Copy link
Author

p6rt commented Feb 3, 2018

@AlexDaniel - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant