On Wed, Sep 16, 2009 at 04:12:22PM -0500, Brian Mastenbrook wrote: > > On Sep 14, 2009, at 10:39 PM, Andrew Reilly wrote: > > >On Mon, Sep 14, 2009 at 04:26:04PM -0500, Brian Mastenbrook wrote: > >>On Sep 14, 2009, at 4:05 PM, John Cowan wrote: > >> > >>>The alternative is to make binary ports and text ports *completely* > >>>disjoint, with the consequential duplication of all the procedures > >>>for > >>>managing them. > >> > >>Not all. You don't need the equivalent of `with-open-input-file', for > >>instance, since `current-input-port' would never sensibly be set to a > >>binary port. > > > >Why ever not? I frequently use binary standard input ports when > >piping audio or compressed data between unix processes. Sure, > >I mostly do that in C, but I want to do it in scheme in the > >future. > > What I meant is that you won't be calling `read' & friends on a binary > input port.
I'd say "sure", because it seems obvious, but I happen to have had to deal with an old data file format that consists of an s-expression header (complete with lisp comments) immediately followed by a blob of (unaligned) binary data. It even caused me to write my first "read" function, in C... Generally you're right, though, and anyone who comes across such a situation could no dobut do what I have done (on separate occasions): close the file after reading the header, then open it again in binary mode, or write an ad-hoc 'read for binary ports. It's not as though either choice is difficult. Cheers, -- Andrew _______________________________________________ r6rs-discuss mailing list [email protected] http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss
