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

Run-time error when calling a sub defined in place inside a statement modifier for loop in Rakudo #2412

Closed
p6rt opened this issue Apr 25, 2011 · 5 comments

Comments

@p6rt
Copy link

p6rt commented Apr 25, 2011

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

Searchable as RT89208$

@p6rt
Copy link
Author

p6rt commented Apr 25, 2011

From @masak

<masak> std​: my %h=1=>"happy";my %s;say [$_,(sub r {return "sad"
if%s{$^n}++;%h{$n}//=r [+] $n.comb»**»2})($_)] for ^10
<p6eval> std 3468e14​: OUTPUT«ok 00​:01 124m␤»
<masak> rakudo​: my %h=1=>"happy";my %s;say [$_,(sub r {return "sad"
if%s{$^n}++;%h{$n}//=r [+] $n.comb»**»2})($_)] for ^10
* masak submits rakudobug
<masak> niecza​: (sub r { say "OH HAI" })() for 5
<p6eval> niecza v4-70-gfb79b12​: OUTPUT«OH HAI␤»
<masak> rakudo​: (sub r { say "OH HAI" })() for 5 [16​:22]
<p6eval> rakudo ecc4ef​: OUTPUT«Could not find sub code_73␤ in <anon>
at line 22​:/tmp/LeVlNG7yDT␤ in main program body at line 1␤»
<sbp> std​: (sub r { say "OH HAI" })() for 5
<p6eval> std 3468e14​: OUTPUT«ok 00​:01 120m␤»
<masak> rakudo​: say "compiles OK"; (sub r { say "OH HAI" })() for 5
<p6eval> rakudo ecc4ef​: OUTPUT«compiles OK␤Could not find sub code_73 [...]
<masak> rakudo​: for 5 { (sub { say "OH HAI" })() }; say "alive"
<p6eval> rakudo ecc4ef​: OUTPUT«alive␤»
<masak> wtf
<masak> niecza​: for 5 { (sub { say "OH HAI" })() }; say "alive"
<p6eval> niecza v4-70-gfb79b12​: OUTPUT«OH HAI␤alive␤»
<TimToady> sink bug?
<TimToady> rakudo​: for 5 { say "OH HAI" }; say "alive"
<p6eval> rakudo ecc4ef​: OUTPUT«OH HAI␤alive␤»
<TimToady> not sink bug

Arguably two distinct bugs. There's a strange error with the statement
modifier, and there's absolutely nothing with the normal for loop.

@p6rt
Copy link
Author

p6rt commented Oct 19, 2011

From @jnthn

On Mon Apr 25 07​:33​:54 2011, masak wrote​:

<masak> std​: my %h=1=>"happy";my %s;say [$_,(sub r {return "sad"
if%s{$^n}++;%h{$n}//=r [+] $n.comb»**»2})($_)] for ^10
<p6eval> std 3468e14​: OUTPUT«ok 00​:01 124m␤»
<masak> rakudo​: my %h=1=>"happy";my %s;say [$_,(sub r {return "sad"
if%s{$^n}++;%h{$n}//=r [+] $n.comb»**»2})($_)] for ^10
* masak submits rakudobug
<masak> niecza​: (sub r { say "OH HAI" })() for 5
<p6eval> niecza v4-70-gfb79b12​: OUTPUT«OH HAI␤»
<masak> rakudo​: (sub r { say "OH HAI" })() for 5 [16​:22]
<p6eval> rakudo ecc4ef​: OUTPUT«Could not find sub code_73␤ in <anon>
at line 22​:/tmp/LeVlNG7yDT␤ in main program body at line 1␤»
<sbp> std​: (sub r { say "OH HAI" })() for 5
<p6eval> std 3468e14​: OUTPUT«ok 00​:01 120m␤»
<masak> rakudo​: say "compiles OK"; (sub r { say "OH HAI" })() for 5
<p6eval> rakudo ecc4ef​: OUTPUT«compiles OK␤Could not find sub code_73
[...]
<masak> rakudo​: for 5 { (sub { say "OH HAI" })() }; say "alive"
<p6eval> rakudo ecc4ef​: OUTPUT«alive␤»
<masak> wtf
<masak> niecza​: for 5 { (sub { say "OH HAI" })() }; say "alive"
<p6eval> niecza v4-70-gfb79b12​: OUTPUT«OH HAI␤alive␤»
<TimToady> sink bug?
<TimToady> rakudo​: for 5 { say "OH HAI" }; say "alive"
<p6eval> rakudo ecc4ef​: OUTPUT«OH HAI␤alive␤»
<TimToady> not sink bug

Arguably two distinct bugs. There's a strange error with the statement
modifier, and there's absolutely nothing with the normal for loop.

Both fixed​:

for 5 { (sub { say "OH HAI" })() }; say "alive"
OH HAI
alive
(sub r { say "OH HAI" })() for 5
OH HAI

Tagging testneeded.

/jnthn

@p6rt
Copy link
Author

p6rt commented Oct 19, 2011

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

@p6rt
Copy link
Author

p6rt commented Jan 26, 2014

From @peschwa

Am Mi 19. Okt 2011, 14​:33​:15, jnthn@​jnthn.net schrieb​:

On Mon Apr 25 07​:33​:54 2011, masak wrote​:

<masak> std​: my %h=1=>"happy";my %s;say [$_,(sub r {return "sad"
if%s{$^n}++;%h{$n}//=r [+] $n.comb»**»2})($_)] for ^10
<p6eval> std 3468e14​: OUTPUT«ok 00​:01 124m␤»
<masak> rakudo​: my %h=1=>"happy";my %s;say [$_,(sub r {return "sad"
if%s{$^n}++;%h{$n}//=r [+] $n.comb»**»2})($_)] for ^10
* masak submits rakudobug
<masak> niecza​: (sub r { say "OH HAI" })() for 5
<p6eval> niecza v4-70-gfb79b12​: OUTPUT«OH HAI␤»
<masak> rakudo​: (sub r { say "OH HAI" })() for 5 [16​:22]
<p6eval> rakudo ecc4ef​: OUTPUT«Could not find sub code_73␤ in <anon>
at line 22​:/tmp/LeVlNG7yDT␤ in main program body at line 1␤»
<sbp> std​: (sub r { say "OH HAI" })() for 5
<p6eval> std 3468e14​: OUTPUT«ok 00​:01 120m␤»
<masak> rakudo​: say "compiles OK"; (sub r { say "OH HAI" })() for 5
<p6eval> rakudo ecc4ef​: OUTPUT«compiles OK␤Could not find sub code_73
[...]
<masak> rakudo​: for 5 { (sub { say "OH HAI" })() }; say "alive"
<p6eval> rakudo ecc4ef​: OUTPUT«alive␤»
<masak> wtf
<masak> niecza​: for 5 { (sub { say "OH HAI" })() }; say "alive"
<p6eval> niecza v4-70-gfb79b12​: OUTPUT«OH HAI␤alive␤»
<TimToady> sink bug?
<TimToady> rakudo​: for 5 { say "OH HAI" }; say "alive"
<p6eval> rakudo ecc4ef​: OUTPUT«OH HAI␤alive␤»
<TimToady> not sink bug

Arguably two distinct bugs. There's a strange error with the statement
modifier, and there's absolutely nothing with the normal for loop.

Both fixed​:

for 5 { (sub { say "OH HAI" })() }; say "alive"
OH HAI
alive
(sub r { say "OH HAI" })() for 5
OH HAI

Tagging testneeded.

/jnthn

Added tests to roast in commit 06a737b as per the examples above.

@p6rt
Copy link
Author

p6rt commented Jan 26, 2014

@FROGGS - 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