[R6RS] R5RS-compliant mode

William D Clinger will
Tue Sep 7 12:42:23 EDT 2004


Thank you, Mike, Marc, Matthew, and Kent.

Kent wrote:
> Does R5RS actually specify a printed representation for mixed-case
> symbols?

No.  Section 6.6.3 says that WRITE writes "a written representation
of obj to the given port", with additional requirements stated for
strings and characters, but says nothing about symbols or vectors or
lists.  So far as I can tell, the R5RS allows a WRITE procedure that
never writes a representation that can be read by the READ procedure.

The description of STRING->SYMBOL in section 6.3.3 says

    ....This procedure can create symbols with names containing
    special characters or letters in the non-standard case, but
    it is usually a bad idea to create such symbols because in
    some implementations of Scheme they cannot be read as themselves.

My scanner and parser generators use this bad idea.  For Java and
similar languages, I had to write my own version of WRITE anyway,
and the specifications of STRING->SYMBOL and SYMBOL->STRING are
tight enough to make that possible.  For Scheme, I cheated by
using the R5RS version of WRITE.  That isn't portable.

>From what the R5RS says, it's hard to imagine any use of the WRITE
procedure that would be portable.  That's why I brought it up here:
it's our job to make it easier for people to write portable code.
At the very least, if obj has a standard external representation,
then we should require (WRITE obj) to write something that READ can
read.

In a draft of their workshop paper, Kelsey and Sperber identified
portability issues with respect to output of inexact numbers.  The
problems go far beyond numeric output.

Will


More information about the R6RS mailing list