This and other RFCs are available on the web at
http://dev.perl.org/rfc/
=head1 TITLE
Lazy Input
=head1 VERSION
Maintainer: Adam Turoff <[EMAIL PROTECTED]>
Date: 24 Sep 2000
Mailing List: [EMAIL PROTECTED]
Number: 285
Version: 1
Status: Developing
=head1 ABSTRACT
Currently, file read operations work in either scalar context or list
context. When the left-hand-side of an input operation contains a finite
list of scalars, a finite number of records should be returned, rather than
reading all of the records and losing most of them.
=head1 DESCRIPTION
Tom Christiansen proposed this in his perl6storm message:
=item perl6storm #0000
This:
($a,$b) = <FH>;
should not drain whole ahndle on known LHS count, to rescue
my($x) = <FH>;
As Tom points out, this is an accidental misfeature, caused by enabling
@lines = <FH>;
to be sensible.
=head1 IMPLEMENTATION
Tricky.
Perl needs to know about scalar context, list context, and "finite list"
context. Presumably, if I/O routines behave this way, user subs should be
able to behave this way as well. Might use the same machinery as lazy subs.
Another approach would be to allow input operations to be magical, because
operations like
($a, $b) = <F>;
my ($c) = <F>;
use common idioms, and should be made to work intuitively. As such, the
special quasi-list context is only a concern for I/O operations, should
such a context need to exist. That is, the I/O internals for Perl6 would
be necessarily smarter than general subs, but only because they need to be.
=head1 REFERENCES
RFC 22: Control flow: Builtin switch statement
RFC 123: Builtin: lazy
perl6storm