Hello,

On Thu, Jan 31, 2013 at 5:00 PM, Ludovic Courtès <l...@gnu.org> wrote:

> There are several issues IMO.  First, some are subrs, so handling
> keyword arguments is going to be painful.  Second, keyword arguments are
> inelegant IMO compared to:
>
>   (set-port-encoding! port (file-encoding port))
>

I don't have much experience in this area, but what about making a Scheme
binding for scm_i_scan_for_encoding, and then doing something like

(define (open-file filename mode #:encoding enc)
  (let ((port (open-file filename mode)))
    (set-port-encoding! port
                                 (if (eq? enc 'guess-encoding)
                                    (scan-for-encoding port)
                                    enc))))

Of course, that doesn't address your second point.

Best,
Noah

Reply via email to