[r6rs-discuss] Stateful codecs and inefficient transcoding

From: John Cowan <cowan>
Date: Mon Nov 6 10:55:16 2006

Marcin 'Qrczak' Kowalczyk scripsit:

> But in reality they don't necessarily come in pairs. For example it
> makes sense to consider a newline converter which accepts several
> conventions on input; this makes no sense for output. A compressor
> often has settable parameters, but the corresponding decompressor
> reads the parameters from the stream, they are not specified
> separately.

What you say is true, but not I think necessarily significant. So the
parameters will have no meaning on output -- what of it? This is
equivalent to the case I discussed earlier, where multiple internal
(Unicode)aracters may be output as a single foreign encoded characters,
but hardly vice versa.

It is already explicitly laid down that passing through the same
transcoder in opposite directions need not be an identity transform.

I'm still waiting for a use-case involving stacked transcoders where
neither one is the identity transcoder.

> Such interference has a purpose: this a way for mixing text and binary
> i/o on the same stream, or for using multiple encodings (other than
> extracting byte arrays and transcoding them separately).

That reminds me: there should be a procedure to apply a transcoder to a
string and produce a byte object (virtual output) and another to apply
a transcoder to a byte object and produce a string (virtual input).
Providing these would make it easy to dissect text embedded in binary
streams without worrying about buffering issues, since when a text is so
embedded there is almost always a byte-level way of determining its end,
either a count or a sentinel byte.

-- 
After fixing the Y2K bug in an application:     John Cowan
        WELCOME TO <censored>                   cowan_at_ccil.org
        DATE: MONDAK, JANUARK 1, 1900           http://www.ccil.org/~cowan
Received on Mon Nov 06 2006 - 10:54:57 UTC

This archive was generated by hypermail 2.3.0 : Wed Oct 23 2024 - 09:15:00 UTC