On Fri, Sep 04, 2009 at 10:04:37PM -0400, John Cowan wrote:
> I'm a little reluctant to say that codecs are entirely unnecessary, since
> system defaults may well not suffice, although only the ASCII (trivial)
> codec should be required.  There are just too many files lying about
> systems these days with non-standard encodings.  If codecs are restored,
> I propose this interface:
> 
>         [something like R6RS io ports] port-codec, set-port-codec!
> 
> If no codec is set and textual I/O is done, the system default applies.

Codecs sound too much like special-casing to me.  If custom ports are
supported in Thing One, couldn't "codecs" be handled simply by a
procedure accepting a port and returning a new port which applies the
codec to the original port?

I've done something similar in the "intarweb" egg for Chicken Scheme,
which uses user-defined ports to convert a port into a chunked HTTP/1.1
content-encoding port.  Why not do the same to convert line endings?
If all ports are inherently binary, a textual port could be obtained by
wrapping calling, say, a (->utf8-port my-port) converter around it.
Newlines could be similarly handled where needed.  This way, one can
arbitrarily mix encoding converters with newline converters.

Cheers,
Peter
-- 
http://sjamaan.ath.cx
--
"The process of preparing programs for a digital computer
 is especially attractive, not only because it can be economically
 and scientifically rewarding, but also because it can be an aesthetic
 experience much like composing poetry or music."
                                                        -- Donald Knuth

Attachment: pgpSKjW6Wmonr.pgp
Description: PGP signature

_______________________________________________
r6rs-discuss mailing list
[email protected]
http://lists.r6rs.org/cgi-bin/mailman/listinfo/r6rs-discuss

Reply via email to