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

while (...splice...) runs forever #3057

Closed
p6rt opened this issue Feb 21, 2013 · 7 comments
Closed

while (...splice...) runs forever #3057

p6rt opened this issue Feb 21, 2013 · 7 comments

Comments

@p6rt
Copy link

p6rt commented Feb 21, 2013

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

Searchable as RT116897$

@p6rt
Copy link
Author

p6rt commented Feb 21, 2013

From @rjbs

This program never terminates​:

  use v6;

  my @​a = << >>;

  while (my @​c = splice @​a, 0, 3) {
  say "one more";
  }

This is perl6 version 2013.01-136-g0d261a3 built on parrot 4.10.0 revision
RELEASE_4_10_0

--
rjbs

@p6rt
Copy link
Author

p6rt commented Feb 25, 2013

From @pmichaud

On Thu, Feb 21, 2013 at 09​:07​:44AM -0800, Ricardo SIGNES wrote​:

This program never terminates​:

use v6;

my @​a = << >>;
while (my @​c = splice @​a, 0, 3) {
say "one more";
}

After each splice, @​c ends up being @​(Any, Any, Any). I'm not
sure if this is correct; I can see that it should probably
return whatever is actually in the array and not pad.

The following should work​:

  my @​a = ();

  while ( @​a ) {
  my @​c = splice @​a, 0, 3;
  say "one more";
  }

Hope this helps,

Pm

@p6rt
Copy link
Author

p6rt commented Feb 25, 2013

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

@p6rt
Copy link
Author

p6rt commented Feb 26, 2013

From @rjbs

Thanks, Patrick. I used a similar workaround.

The notion that the behavior we see in Rakudo (but not in N~) came from Larry. I think the last
paragraph here is on point​:

http://perlcabal.org/syn/S32/Containers.html#splice

And​:

20​:11 <TimToady> and well motivated, insofar as it makes it much easier to
  write a loop with it
20​:11 <rjbs> indeed
20​:11 <TimToady> not to mention prior art in p5

Thanks!

@p6rt
Copy link
Author

p6rt commented Jan 27, 2015

From @Mouq

Behavior change​:

$ perl6 -e'my @​a = << >>; while (my @​c = splice @​a, 0, 3) { say "one more"; }'
$ perl6 -v
This is perl6 version 2015.01-32-geea99e3 built on MoarVM version 2015.01-5-ga29eaa9

Looks good to me; marking as testneeded

On Mon Feb 25 17​:12​:10 2013, rjbs wrote​:

Thanks, Patrick. I used a similar workaround.

The notion that the behavior we see in Rakudo (but not in N~) came
from Larry. I think the last
paragraph here is on point​:

http://perlcabal.org/syn/S32/Containers.html#splice

And​:

20​:11 <TimToady> and well motivated, insofar as it makes it much
easier to
write a loop with it
20​:11 <rjbs> indeed
20​:11 <TimToady> not to mention prior art in p5

Thanks!

@p6rt
Copy link
Author

p6rt commented Mar 4, 2015

From @Mouq

Test added in Roast commit​:

commit e75f03bf2d9b9b7074fd0077fb5cf4beaeef3e89
Author​: Mouq <alexmoquin@​gmail.com>
Date​: Wed Mar 4 02​:03​:39 2015 -0500

  Add test for RT #​116897

Closing as resolved :)

On Tue Jan 27 14​:17​:08 2015, Mouq wrote​:

Behavior change​:

$ perl6 -e'my @​a = << >>; while (my @​c = splice @​a, 0, 3) { say "one
more"; }'
$ perl6 -v
This is perl6 version 2015.01-32-geea99e3 built on MoarVM version
2015.01-5-ga29eaa9

Looks good to me; marking as testneeded

On Mon Feb 25 17​:12​:10 2013, rjbs wrote​:

Thanks, Patrick. I used a similar workaround.

The notion that the behavior we see in Rakudo (but not in N~) came
from Larry. I think the last
paragraph here is on point​:

http://perlcabal.org/syn/S32/Containers.html#splice

And​:

20​:11 <TimToady> and well motivated, insofar as it makes it much
easier to
write a loop with it
20​:11 <rjbs> indeed
20​:11 <TimToady> not to mention prior art in p5

Thanks!

@p6rt
Copy link
Author

p6rt commented Mar 4, 2015

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

@p6rt p6rt closed this as completed Mar 4, 2015
@p6rt p6rt added the testneeded label Jan 5, 2020
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