[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Srfi-159/166 - monadic formatting for guile
From: |
Mark H Weaver |
Subject: |
Re: Srfi-159/166 - monadic formatting for guile |
Date: |
Sun, 16 Jun 2019 15:30:07 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) |
Hi John,
John Cowan <address@hidden> writes:
> On Sun, Jun 16, 2019 at 2:47 AM Mark H Weaver <address@hidden> wrote:
>
>
>> How do you implement 'written-shared', 'pretty-shared', and
>> 'trimmed/lazy'? In particular, how do you avoid non-termination when
>> asked to print cyclic data, when the cycle includes a non-standard data
>> type printed using a custom printer? For example, what if you print a
>> list that includes an object whose custom printer will print output that
>> includes the same list that you started with?
>>
>
> Of course it can't cope with that. But consider an object whose custom
> printer outputs its instance variables where one of those instance variables
> has been assigned to the object itself. No procedure other than the object
> printer itself is going to be able to break *that* loop.
The built-in 'write' and 'display' procedures can break the loop, which
is the approach that I chose when I last looked at this.
Regards,
Mark