[Top][All Lists]

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

[Chicken-users] extras.scm: make-output-port wise or not?

From: Joerg F. Wittenberger
Subject: [Chicken-users] extras.scm: make-output-port wise or not?
Date: 03 Jan 2003 10:20:01 +0100

Hi all,

I came across the definition of make-output-port in extras.scm; there
I found:

(define make-output-port
         port 2
         (lambda (op port args)
           (case op
             [(#:close-output-port) (close)]
             [(#:flush-output) #f]
             [(#:write-char) (write (string args))]
             [(#:write-string) (write (string-copy args))]

Is this really wise to copy the string here?  I understand that the
'write' operation could - in theory - modify it's argument.  But I'd
argue that this should be forbidden by policy (i.e., documented as
beeing an error if it does; the result may be unspecified).  Copying
the string seems a silly prise to pay here.

             [(#:close-input-port #:char-ready? #:read-char #:peek-char)
              (unsup op) ]
             [(#:data) data]

BTW: what is this operation good for?

             [else ##sys#snafu] ) ) )
        port) ) ) )

Best regards


The worst of harm may often result from the best of intentions.

reply via email to

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