perl6/rakudo: Does perl6 enable "autoflush" by default?
Asked Answered
B

2

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.

Bard answered 20/2, 2011 at 8:54 Comment(3)
It looks like the world has changed in the last six years.Skewbald
Rakudo doesn't support autoflush. There's a note in 5to6-perlvar under the $OUTPUT_AUTOFLUSH entry.Skewbald
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.Practitioner
S
8

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

Sisk answered 20/2, 2011 at 9:58 Comment(1)
Rakudo doesn't support autoflush. There's a note in 5to6-perlvar under the $OUTPUT_AUTOFLUSH entry.Skewbald
A
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.

Amadis answered 30/3, 2019 at 7:54 Comment(1)
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.Practitioner

© 2022 - 2024 — McMap. All rights reserved.