perl6/rakudo: Does perl6 enable “autoflush” by default?

放肆的年华 提交于 2020-01-03 15:59:39

问题


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


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/5056085/perl6-rakudo-does-perl6-enable-autoflush-by-default

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!