guile-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Do not scan for coding declarations in open-file


From: Noah Lavine
Subject: Re: [PATCH] Do not scan for coding declarations in open-file
Date: Thu, 31 Jan 2013 17:19:59 -0500

Hello,


On Thu, Jan 31, 2013 at 5:00 PM, Ludovic Courtès <address@hidden> 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

[Prev in Thread] Current Thread [Next in Thread]