"Andrew Shitov" <[EMAIL PROTECTED]> wrote in message
news:[EMAIL PROTECTED]
> DW>   my $text is TextFile("/tmp/bar");
> DW>   $text = "hello"; # writes, truncates
> DW>   $text ~= ", world\n"; # appends
>
> DW>   $text.print "again\n"; # for old-times sake
>
> Anyhow we still need $text.flush() or $text.close() methods.

I'd argue that these are only rarely needed. Even with Perl5 filehandles, I
rarely find myself needing to close a file. Garbage collection does the job
adequately.

The case of "flush" is more interesting. It is really used for two purposes:
forcing the ram-contents to be stored on disk, so it can be recovered even
id the process dies violently, is one use; ensuring a message is sent so it
can be received by a consumer is the other. Even if both these roles have
the same underlying implementation, we might want to abstract them
differently. C<flush> is as good a name as any for the sync-to-disc usage;
but the second might be better named C<send> -- and probably wouldn't be on
a "text" object, anyway. I'm not sure that the details of inter-thread
messaging have been decided yet, but I'd think that a common messaging
paradigm would apply.

Dave.


Reply via email to