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

two questions



>Could the responsible parties please answer these questions, and post
>the questions and answers to the scheme mailing list?  Thanks.
>-Jonathan

Maybe that should be "irresponsible parties".  I guess someone has to take
the rap, so here are my excuses.

    1) The report mentions two procedures (close-input-port <port>) and
       (close-output-port <port>).  I don't see why it is necessary to
       have two procedures to close ports.  Wouldn't it be sufficient
       to have something like "close-port" that can be applied to both
       types of ports?

Yes, and I would not be surprised if most Scheme implementations do it
that way internally.  OPEN-INPUT-FILE and OPEN-OUTPUT-FILE need to be
distinct, and I guess it seemed more symmetric for them to have distinct
"inverses".

    2) What is the exact difference between (write-char <char>) and
       (display <char>)?  "write-char" seems to be redundant.  Is "display"
       supposed to terminate its output by a space or newline or something
       like this?

Chris Hanson noted the historical fact that DISPLAY originally acted like
WRITE on characters, so WRITE-CHAR was once necessary for that reason.  He
noted also that DISPLAY, being generic, is likely to be much less efficient
than WRITE-CHAR.  Kent Dybvig pointed out that characters are not guaranteed
to be distinct from other data types, say small integers or strings of one
character, so WRITE-CHAR is the only portable way you can write a character
itself as opposed to some representation of the character.  Thus WRITE-CHAR
remains necessary.

Peace,
William Clinger