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

Stringifying the result of a Zxx operation exposes what is probably a variation of the take bug in Rakudo #2176

Closed
p6rt opened this issue Sep 24, 2010 · 6 comments

Comments

@p6rt
Copy link

p6rt commented Sep 24, 2010

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

Searchable as RT78026$

@p6rt
Copy link
Author

p6rt commented Aug 18, 2010

From patrick.abisalloum@gmail.com

sub foo {
  my @​a = (1,2,3,4,5);
  gather {
  my $val ;
  while @​a {
  $val = @​a.shift();
  take $val;
  }
  }
};

say foo().join('') ; #outputs 55555
say foo(); #outputs 12345

Moving the my $val to inside the while produces 12345 in both cases

<patrickas> rakudo​: sub foo {my @​a = (1,2,3,4,5);my $val ;gather
{while @​a {$val = @​a.shift();take $val;}}};say ~( foo() ) ; say foo();
<+p6eval> rakudo 037f68​: OUTPUT«5 5 5 5 5â ¤12345â ¤»
<patrickas> is that ^^ a known bug ?? Is it a bug at all ?
<TimToady> not a bug, really
<TimToady> put the my inside the while loop
<TimToady> you've just taken five refs to the same var
<TimToady> though, perhaps a bug, nonetheless
<TimToady> since take is supposed to de-containerize like return

@p6rt
Copy link
Author

p6rt commented Sep 24, 2010

From @masak

<masak> rakudo​: say (<a b c d e> Zxx 0,1,0,1,0) # via TimToady, backlog
<p6eval> rakudo 5e7b43​: OUTPUT«bd␤»
<masak> rakudo​: say (<a b c d e> Zxx 0,1,0,1,0).Str
<p6eval> rakudo 5e7b43​: OUTPUT«e e␤»
* masak submits rakudobug
<pmichaud> looks like a variation of the take bug again
<masak> aye.
<pmichaud> rakudo​: say (<a b c d
e>)[(0,1,0,1,0).pairs.grep(*.value).keys].Str # just curious
<p6eval> rakudo 5e7b43​: OUTPUT«a b␤»

@p6rt
Copy link
Author

p6rt commented Oct 13, 2011

From @masak

On Fri Sep 24 06​:25​:32 2010, masak wrote​:

<masak> rakudo​: say (<a b c d e> Zxx 0,1,0,1,0) # via TimToady,
backlog
<p6eval> rakudo 5e7b43​: OUTPUT«bd␤»
<masak> rakudo​: say (<a b c d e> Zxx 0,1,0,1,0).Str
<p6eval> rakudo 5e7b43​: OUTPUT«e e␤»
* masak submits rakudobug
<pmichaud> looks like a variation of the take bug again
<masak> aye.
<pmichaud> rakudo​: say (<a b c d
e>)[(0,1,0,1,0).pairs.grep(*.value).keys].Str # just curious
<p6eval> rakudo 5e7b43​: OUTPUT«a b␤»

<moritz> rakudo​: say (<a b c d e> Zxx 0,1,0,1,0)
<p6eval> rakudo 3e66bd​: OUTPUT«b d␤»
<moritz> so https://rt-archive.perl.org/perl6/Ticket/Display.html?id=78026 is
fixed it seems
<masak> I'll mark #​78026 as needstest

@p6rt
Copy link
Author

p6rt commented Oct 13, 2011

@masak - Status changed from 'new' to 'open'

@p6rt
Copy link
Author

p6rt commented Oct 13, 2011

From @moritz

Tested in S04-statements/gather.t.

@p6rt
Copy link
Author

p6rt commented Oct 13, 2011

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