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

Re: [Scheme-reports] display should not guarantee termination

On 11/22/2012 06:22 PM, John Cowan wrote:> Per Bothner scripsit:
> How can infinite output be human-readable?  Humans don't have infinite
> life spans.

A multi-GB output file isn't human-readable either, but that isn't the
point.  The point is that programs may continue executing "for-ever"
(i.e. until the computer is rebooted), and some some such programs
generate unbounded output - perhaps to some logging device.

> Infinite output can be truncated by another process, but
> in that case `write-simple` or `write-string` is probably the Right Thing.

write-simple adds quotation marks and other escapes.  write-string
might work in practice - mainly because display does emit delimiters
for strings and vectors, which you wouldn't want anyway if you want
unbounded output.   I just feel checking for cycles is not the job
of display.

On 11/22/2012 11:58 PM, John Cowan wrote:
> Shiro Kawai scripsit:
>> The current wording can be read a bit wider than requiring labels on
>> circular objects; that is, it can be read as display must terminate on
>> any objects (even if the object is implementation's extension), which
>> concerns me.  If I can read it that the behavior only describes on the
>> domain of r7rs, I'm ok with it.
> I've changed "However, `display` must always terminate" to "However,
> `display` must not loop forever on circular lists or self-referencing
> vectors".

I still think it is more consistent, as well as simpler, to allow
cyclic structures to produce infinite unbounded output.
	--Per Bothner
per@x   http://per.bothner.com/

Scheme-reports mailing list