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

Re: [Scheme-reports] Write procedure is not backwards compatible

Jonathan Rees <jar@x> wrote:

> Ouch! If true, I second this comment. Backward compatibility
> for write is pretty important. Consider the case of running
> an R5RS (or R7RS) program in an R7RS implementation to generate 
> a file that will be consumed by an R5RS implementation. 
> There is no mention of this incompatibility in the section
> "Language changes since R5RS".

Marc Feeley wrote:

> Formal Comment
> Submitter's name: Marc Feeley
> Submitter's email: feeley at iro.umontreal.ca
> Summary: Write procedure is not backwards compatible
> R7RS introduces a new output procedure called write-simple, which has
> the same semantics as the R5RS write procedure.  On the other hand,
> the R7RS write procedure handles shared structures differently than
> the R5RS.  For example :
>   (let ((x (list 1 2))) (write (list x x)))
>       displays ((1 2) (1 2)) in an R5RS system
>   and displays (#0=(1 2) #0#) in an R7RS system

People are reading this wrong. The intention here is that WRITE 
properly handle circular structures that cannot be printed in 
fully expanded form without infinite output. That is to say, the 
above interpretation of write is incorrect, IIRC.  We do not 
guarantee the same shared structure layout of a written structure, 
but provide a means of serializing circular structures that 
cannot be serialized with WRITE-SIMPLE.

This was not added to the R5RS list of incompatibilities because it 
is not incompatible. Any defined output of R5RS in this case, 
dealing with normal, non-self referential (circular) structures, 
should end up the same way; it is circular structures whose contents 
refer to itself that will be specified now, where they were not, 
to my understanding, in R5RS.

If the standard is not clear on this, we should fix this, as this is 
not an issue of whether we should swap WRITE-SIMPLE with WRITE, but 
one of clearly indicating what should use the circular structure 

Aaron W. Hsu | arcfide@x | http://www.sacrideo.us
Programming is just another word for the lost art of thinking.

Scheme-reports mailing list