This page is part of the web mail archives of SRFI 81 from before July 7th, 2015. The new archives for SRFI 81 are here. Eventually, the entire history will be moved there, including any new messages.
As your commenting on ports, I'm following up on SRFI 81 list, where this belongs. Marc Feeley <feeley@xxxxxxxxxxxxxxxx> writes: > I actually like the R5RS I/O model and think there are more elegant > ways to extend it to support the features that would make it more > practical (binary I/O, Unicode text encoding, devices such as > sockets, processes, etc). For example, for binary I/O, these are > sufficient > > - (read-u8 [port]) reads the next octet from the port > - (read-subu8vector u8vector start end [port]) reads a sequence of > octets into a u8vector > - (write-u8 [port]) writes an octet to the port > - (write-subu8vector u8vector start end [port]) writes a sequence of > octets from a u8vector Admittedly, the Port SRFI defines all of two procedures in addition to those you propose: READ-BLOB-SOME and READ-BLOB-ALL. If that's what people want, I'll be happy to elide them, even though both could typically be implemented more efficiently directly rather than in terms of the others. But I have trouble seeing how eliding them would make the SRFI in any way "more elegant." Care to elaborate? > For Unicode text encoding and end-of-line encoding, just add some > optional parameters to the port opening procedures to supply the port > settings, and a procedure to change the port settings. For example, with > named optional parameters (aka keyword parameters): I don't understand---that exactly what the SRFI does. It has an optional transcoder argument that specifies text encoding and EOL. Moreover, it has procedures to change the buffer mode. How is this more elegant? > - (open-input-file "myfile.txt" char-encoding: 'utf8 buffering: #f) > - (open-file "myfile.txt" direction: 'input char-encoding: 'utf8 > buffering: #f) > - (port-settings-set! myport buffering: #t eol-encoding: 'cr-lf) Sure, there's a slight difference in the division of labor. You can always shift responsibility between the procedures themselves and their arguments. I come down in a slightly different place than you do (and I happen to like my choices better, so there), but it surely makes very little difference in the size and scope of the specs. -- Cheers =8-} Mike Friede, Völkerverständigung und überhaupt blabla