perl6/rakudo: Does perl6 enable “autoflush” by def

2019-06-23 03:36发布

#!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.

2条回答
爷的心禁止访问
2楼-- · 2019-06-23 04:41

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

查看更多
趁早两清
3楼-- · 2019-06-23 04:41

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.

查看更多
登录 后发表回答