arrays-of-scalars Reply-To: [EMAIL PROTECTED] This and other RFCs are available on the web at http://dev.perl.org/rfc/ =head1 TITLE Standard support for opening i/o handles on scalars and arrays-of-scalars =head1 VERSION Maintainer: Eryq (Erik Dorfman) <[EMAIL PROTECTED]> Date: 23 Aug 2000 Mailing List: [EMAIL PROTECTED] Version: 1 Number: 186 Status: Developing =head1 ABSTRACT It's extremely useful to be able to open an i/o handle on common in-core data structures, such as scalars or arrays-of-lines. The CPAN modules IO::Scalar, IO::ScalarArray, and IO::Lines currently provide some of this functionality, but their pure-Perl implementation (chosen for portability) is not as fast or memory-efficient as a native implementation could be. Additionally, since they are not part of the standard Perl distribution, many developers are either unaware of their existence or unwilling to obtain and install them. This RFC proposes that support for "in-core i/o" be folded into the Perl distribution as a standard extension module, making use of native C code for speed. =head1 DESCRIPTION =head1 IMPLEMENTATION As described in the ABSTRACT above. The following I/O handle classes are proposed as minimally necessary; they are taken from existing Perl5 CPAN modules with the same names: =over 4 =item IO::Scalar An I/O handle which can be opened on a scalar (string) variable. We simply treat the bytes of the scalar as a "virtual file". =item IO::ScalarArray An I/O handle which can be opened on an array of scalar (string) variables. Here, the "virtual file" is defined as the concatenation of the scalars in the array. One very common way to obtain such a data structure is to slurp a file into an array. =back If Perl6 follows Java's example of distinguishing "bytes" from "characters", then it should be understood that the proposed I/O handles manipulate I<bytes>, not characters. That is, the Java equivalents are classes like C<java.io.ByteArrayInputStream>. Character-based I/O should be handled by some additional conversion mechanism which is wrapped around byte-based I/O; this mechanism should be applicable to I<any> I/O stream. A look at the Java implementation of byte-oriented "input/output streams" versus character-oriented "readers and writers" is worthwhile for this. =head1 REFERENCES IO::Scalar (CPAN) IO::ScalarArray (CPAN)
