5
#!perl6
use v6;

my $message = "\nHello!\n\nSleep\nTest\n\n";

my @a = $message.split( '' );

for @a {
    sleep 0.3; 
    .print;
}

Does perl6 enable "autoflush" by default. With perl5 without enabling "outflush" I don't get this behavior.

Elizabeth Mattijsen
  • 25,654
  • 3
  • 75
  • 105
sid_com
  • 24,137
  • 26
  • 96
  • 187
  • It looks like the world has changed in the last six years. – brian d foy Jul 08 '17 at 15:09
  • 2
    Rakudo doesn't support autoflush. There's a note in [5to6-perlvar](https://docs.perl6.org/language/5to6-perlvar) under the `$OUTPUT_AUTOFLUSH` entry. – brian d foy Jul 10 '17 at 11:13
  • What behavior? And note that unbuffered != autoflush ... No one who has asked or answered any of the SO questions about autoflush, nor the Rakudo folks, seems to grasp this. – Jim Balter Sep 01 '19 at 06:34

2 Answers2

8

Rakudo enables autoflush by default; the specification is silent about the default.

moritz
  • 12,710
  • 1
  • 41
  • 63
  • 1
    Rakudo doesn't support autoflush. There's a note in [5to6-perlvar](https://docs.perl6.org/language/5to6-perlvar) under the `$OUTPUT_AUTOFLUSH` entry. – brian d foy Jul 10 '17 at 11:13
1

Quoting from the docs regarding auto flush:

‘No global alternative available. TTY handles are unbuffered by default, for others, set out-buffer to zero or use :!out-buffer with open on a specific IO::Handle.’

So any printing to stdout is unbuffered and I guess would behave similar to auto flushed stdout of perl5.

Other handles depend on the out-buffer size set.

drclaw
  • 2,463
  • 9
  • 23
  • unbuffered is not the same as autoflush. No one who has answered any of the SO questions about autoflush, nor the Rakudo folks, seems to grasp this. – Jim Balter Sep 01 '19 at 06:32