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

[Scheme-reports] display should not guarantee termination

The specification for display is:

   However, display must always terminate. Thus if the nor-
   mal write representation is used, datum labels are needed
   to represent cycles as in write.

I think this is wrong, and (arguably) misunderstands what
display is about, which IMO is to produce plain unadorned
human-readable output without extra delimiters.  Infinite
data structures *should* produce infinite output.  Many
programs are intended to run "indefinitely", and so any
attempt to prohibit unbounded output is misguided.

Consider for example an extension with infinite lists or strings,
with automatic forcing.  The semantics of such a string is like
a regular string, but of unbounded length, with characters
calculated as needed.  In that case the "correct" implementation
of display is to display each chunk of text as it becomes available.

I.e. an infinite lazy data-structure should produce infinite
output - and therefore an infinite non-lazy cyclic data-structure
should produce infinite output, for consistency.

I will not implement this rule in Kawa (unless I get around to
doing at as part of a "pedantic" mode), as it conflicts with
my conception of how to handle laziness.
	--Per Bothner
per@x   http://per.bothner.com/

Scheme-reports mailing list