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

Confusion in SPESH about return #5366

Closed
p6rt opened this issue Jun 10, 2016 · 6 comments
Closed

Confusion in SPESH about return #5366

p6rt opened this issue Jun 10, 2016 · 6 comments

Comments

@p6rt
Copy link

p6rt commented Jun 10, 2016

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

Searchable as RT128368$

@p6rt
Copy link
Author

p6rt commented Jun 10, 2016

From @lizmat

m​: class A { has $.foo; method foo { return $!foo } }; my $a = A.new(foo => 42); for ^158 { $a.foo } # first value it breaks on 158
  rakudo-moar 87e91c​: OUTPUT«Attempt to return outside of any Routine␤ in block <unit> at /tmp/9NqzgIZLo_ line 1␤␤»

m​: class A { has $.foo; method foo { return $!foo } }; my $a = A.new(foo => 42); for ^157 { $a.foo } # 157 is ok
  rakudo-moar 87e91c​: ( no output )

With MVM_SPESH_DISABLE=1, this is all ok.

Tux++ for the initial canary!

@p6rt
Copy link
Author

p6rt commented Jun 10, 2016

From @lizmat

It appears we can golf this down further​:

m​: class A { method foo { return 42 } }; my $a = A.new; for ^157 { $a.foo } # still smaller golf, no attributes neede
  rakudo-moar 87e91c​: ( no output )
m​: class A { method foo { return 42 } }; my $a = A.new; for ^158 { $a.foo } # at 158 it fails
  rakudo-moar 87e91c​: OUTPUT«Attempt to return outside of any Routine␤ in block <unit> at /tmp/OZc4EqaZLv line 1␤␤»
m​: sub foo() { return 42 }; for ^157 { foo } # still smaller golf
  rakudo-moar 87e91c​: ( no output )
m​: sub foo() { return 42 }; for ^158 { foo } # fails at 158
  rakudo-moar 87e91c​: OUTPUT«Attempt to return outside of any Routine␤ in block <unit> at /tmp/tOCcim2lY1 line 1␤␤»

Of course, if there had been a Routine outside, this error would have been silent! Just done the wrong thing!

@p6rt
Copy link
Author

p6rt commented Jul 9, 2016

From @zoffixznet

For records,

The tests for this ticket already exist at https://github.com/perl6/roast/blob/a9597e6781703f012399dd5a1f988028e2279afc/integration/weird-errors.t#L205

As stated in commit Raku/roast@a9597e6 this bug is currently worked-around rather than fixed entirely.

@p6rt
Copy link
Author

p6rt commented Jul 9, 2016

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

@p6rt
Copy link
Author

p6rt commented Jul 21, 2016

From @jnthn

On Fri Jul 08 22​:00​:54 2016, cpan@​zoffix.com wrote​:

For records,

The tests for this ticket already exist at
https://github.com/perl6/roast/blob/a9597e6781703f012399dd5a1f988028e2279afc/integration/weird-
errors.t#L205

As stated in commit
Raku/roast@a9597e6
this bug is currently worked-around rather than fixed entirely.

From a Perl 6 perspective, this is sufficiently fixed. The workaround is safe, it just means MoarVM can't optimize stuff so well as would be nice. But that doesn't need an RT here.

@p6rt
Copy link
Author

p6rt commented Jul 21, 2016

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

@p6rt p6rt closed this as completed Jul 21, 2016
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