[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: segmentation fault writing cyclic term
From: |
Daniel Diaz |
Subject: |
Re: segmentation fault writing cyclic term |
Date: |
Fri, 10 Dec 2021 08:49:49 +0100 |
Hi Paul,
Acyclic terms are not supported but the predicate acyclic_term/1 if provided to
test if a term is acyclic. You can use it before printing a term.
The top-level does this before printing a solution (else it emits the error
message you mentioned).
Daniel
> Le 4 déc. 2021 à 17:55, Paul Eggert <eggert@cs.ucla.edu> a écrit :
>
> On 12/4/21 03:21, Paulo Moura wrote:
>>> | ?- X = X+1, write(X).
>>> X = X+1, write(X).
>>> Segmentation fault (core dumped)
>>>
>>>
>>> Shouldn't write/1 be protected against cyclic terms?
>> Note that support for cyclic terms is not a ISO Prolog standard requirement.
>
> Quite right, this is not a standards violation. Still, gprolog already
> defends against cyclic terms when it outputs them:
>
> | ?- X=X+1.
>
> cannot display cyclic term for X
>
> so presumably it could defend against them in 'write' if this was considered
> useful (which it would be, for my students...).
>