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!

Reply via email to