Em Seg, 2009-02-02 às 09:37 -0800, Larry Wall escreveu:
> It's also not clear how this should interact with buffering systems
> like stdio. But in any case, speaking directly to the IO stack is
> likelier to give consistent results than playing mix-n-match with
> various calls on the IO stack that make various assumptions.
The question here is, will Perl 6 IO use stdio.h or re-implement its
features?
My first shot at it would be...
role IO {
has $.fd;
}
role IO::Blocking {
has Bool $.blocking;
}
role IO::Closeable {
method close {...}
}
role IO::Readable {
# no buffer
method int read($buf is rw, int $count) {...}
}
role IO::Writeable {
# no buffer
method int write($buf, int $count) {...}
}
role IO::Buffered {
# buffer
has Bool $.autoflush is rw;
method flush {...}
}
role IO::Char does IO::Buffered {
method getc {...}
method fread {...}
...
}