On Sat, 2009-12-26 at 12:39 +0100, [email protected] wrote: > How can I specify (latin-1-codec) as the default transcoder > for all input and output ports created by call-with-input-file, > call-with-output-file and friends in Ikarus?
That's not currently possible. If `native-transcoder' could be set (e.g. `parameterize'ed), it would be possible. You can submit a request (use "report a bug" and "wishlist" status) for this at https://bugs.launchpad.net/ikarus But, setting `native-transcoder' and having it affect the R6RS procedures which use a default transcoder is not R6RS-portable, for two reasons: 1) R6RS specifies that `native-transcoder' takes only zero arguments, and R6RS is strict and requires (IIUC) an exception be raised if any of its procedures are called with arguments (or types) which R6RS does not specify; i.e. calling `native-transcoder' with an argument to set it is an error according to R6RS. However, Ikarus already does not conform in this regard with the `current-X-port' procedures, i.e. they can be called with an argument to set them, so Aziz is probably open to allowing it for `native-transcoder'. 2) R6RS does not say that any of its procedures are affected by the current value of `native-transcoder'. Ikarus happens to use it, but other R6RS systems may not. I consider these flaws in R6RS. I think `native-transcoder' should be named `current-transcoder', it should be a parameter, its default value should be the system's native transcoder, and it should be specified to affect all procedures which use a default transcoder. You can instead use `call-with-port', `open-file-input-port', `open-file-output-port', and `make-transcoder'. That's more tedious, so when I have to do that I usually make an abstraction. You could make a `current-transcoder' parameter and make versions of the default-transcoder-using procedures which use it. -- : Derick ----------------------------------------------------------------
