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

Strange behaviour on "say". #5750

Closed
p6rt opened this issue Oct 15, 2016 · 10 comments
Closed

Strange behaviour on "say". #5750

p6rt opened this issue Oct 15, 2016 · 10 comments

Comments

@p6rt
Copy link

p6rt commented Oct 15, 2016

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

Searchable as RT129884$

@p6rt
Copy link
Author

p6rt commented Oct 15, 2016

From jan.popov@gmail.com

Hi,

Maybe this is known bug, maybe not :-) But I cannot finding it on
https://rt.perl.org.
I found very strange behaviour on "say".
If we run code below then the "test" not appeared, but if we uncomment row
#say 'run';
the "test" appeared.

# This is Rakudo version 2016.07.1 built on MoarVM version 2016.07
# implementing Perl 6.c.
# Linux 4.2.0-42-generic #​49~14.04.1-Ubuntu SMP Wed Jun 29 20​:22​:11 UTC
2016 x86_64 x86_64 x86_64 GNU/Linux

sub test {
  loop (my $i = 0; $i < 10; ++$i) {
  loop (my $j = 0; $j < 10; ++$j) {
  say 'test';
  }
  }
  #say 'run';
}

test;

@p6rt
Copy link
Author

p6rt commented Oct 15, 2016

From 1parrota@gmail.com

A clue, for what it's worth.

Any valid instruction, (or even a variable declaration) after the "}"
ending the innermost loop appears to enable the output. Inside the
loop, it doesn't..

On 10/15/16, janko popov <perl6-bugs-followup@​perl.org> wrote​:

# New Ticket Created by janko popov
# Please include the string​: [perl #​129884]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=129884 >

Hi,

Maybe this is known bug, maybe not :-) But I cannot finding it on
https://rt.perl.org.
I found very strange behaviour on "say".
If we run code below then the "test" not appeared, but if we uncomment row
#say 'run';
the "test" appeared.

# This is Rakudo version 2016.07.1 built on MoarVM version 2016.07
# implementing Perl 6.c.
# Linux 4.2.0-42-generic #​49~14.04.1-Ubuntu SMP Wed Jun 29 20​:22​:11 UTC
2016 x86_64 x86_64 x86_64 GNU/Linux

sub test {
loop (my $i = 0; $i < 10; ++$i) {
loop (my $j = 0; $j < 10; ++$j) {
say 'test';
}
}
#say 'run';
}

test;

@p6rt
Copy link
Author

p6rt commented Oct 15, 2016

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

@p6rt
Copy link
Author

p6rt commented Oct 15, 2016

From @timo

On 10/15/2016 01​:26 PM, janko popov (via RT) wrote​:

# New Ticket Created by janko popov
# Please include the string​: [perl #​129884]
# in the subject line of all future correspondence about this issue.
# <URL​: https://rt-archive.perl.org/perl6/Ticket/Display.html?id=129884 >

Hi,

Maybe this is known bug, maybe not :-) But I cannot finding it on
https://rt.perl.org.
I found very strange behaviour on "say".
If we run code below then the "test" not appeared, but if we uncomment row
#say 'run';
the "test" appeared.

# This is Rakudo version 2016.07.1 built on MoarVM version 2016.07
# implementing Perl 6.c.
# Linux 4.2.0-42-generic #​49~14.04.1-Ubuntu SMP Wed Jun 29 20​:22​:11 UTC
2016 x86_64 x86_64 x86_64 GNU/Linux

sub test {
loop (my $i = 0; $i < 10; ++$i) {
loop (my $j = 0; $j < 10; ++$j) {
say 'test';
}
}
#say 'run';
}

test;

This is about lazy lists and sinking. When you make the loop the
not-last line, it'll be the return value of the sub.

Tbh, i would have expected the call to test in sink context (i.e. not
assigning anything) to cause the full execution of that loop.

@p6rt
Copy link
Author

p6rt commented Oct 15, 2016

From @timo

Actually, I just tested the code and on my machine it always outputs
"test". The only difference between uncommenting "say 'run'" is that
it'll output "run" once at the end - or not.

So now I'm wondering what i did differently from you?!

@p6rt
Copy link
Author

p6rt commented Oct 15, 2016

From @TimToady

On Sat, Oct 15, 2016 at 09​:59​:01PM +0200, Timo Paulssen wrote​:
: Actually, I just tested the code and on my machine it always outputs
: "test". The only difference between uncommenting "say 'run'" is that
: it'll output "run" once at the end - or not.
:
: So now I'm wondering what i did differently from you?!

Used a newer version, I'll warrant.

Larry

@p6rt
Copy link
Author

p6rt commented Oct 15, 2016

From @TimToady

On Sat, Oct 15, 2016 at 09​:59​:01PM +0200, Timo Paulssen wrote​:
: Actually, I just tested the code and on my machine it always outputs
: "test". The only difference between uncommenting "say 'run'" is that
: it'll output "run" once at the end - or not.
:
: So now I'm wondering what i did differently from you?!

More precisely, this was fixed in​:

  commit 589061eac14f2847e2c4b401d2ff2eb30c62675e
  Author​: TimToady <larry@​wall.org>
  Date​: Fri Aug 5 15​:57​:18 2016 -0700

  loop and repeat not properly self-sinking
 
  Loops at statementlist level should be self-sinking by default.
  The loop and repeat forms of loop were not doing this correctly.
  Fixes RT #​127563 and RT #​128596.

Larry

@p6rt
Copy link
Author

p6rt commented Oct 16, 2016

From 1parrota@gmail.com

Rakudo*'s latest version (2016.07.01) has
perl6​::build-date=2016-07-22T12​:37​:00Z which indeed predates that
commit Fri Aug 5 15​:57​:18 2016 -0700
.

@p6rt
Copy link
Author

p6rt commented Dec 4, 2016

From @zoffixznet

On Sun, 16 Oct 2016 08​:11​:38 -0700, 1parrota@​gmail.com wrote​:

Rakudo*'s latest version (2016.07.01) has
perl6​::build-date=2016-07-22T12​:37​:00Z which indeed predates that
commit Fri Aug 5 15​:57​:18 2016 -0700
.

TimToady's patch did come with tests. Closing with no action.

@p6rt
Copy link
Author

p6rt commented Dec 4, 2016

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

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