write/1 cyclic term writes core dump
Closed this issue · 2 comments
flexoron commented
| ?- X = (\+X).
cannot display cyclic term for X
yes
| ? X = (\+X), write(X).
\+ \+ \+ \+ \+ \+ \+ \+ \+ \+ \+ \+ \+ \+ \+ \+ \+
:
:
\+ \+ \+ \+ \+ \+Segmentation fault (core dumped)
$
didoudiaz commented
There is no support for cyclic term except the built-in acyclic_term/1
. Use it to check if a term is acyclic before printing it else inform the user (it is what does the top-level). BTW, another useful built-in is unify_with_occurs_check/2
which fails instead of creating a cyclic term.
flexoron commented
Thank you. I accept the advice.
But from C programmers point of view, core dumps are only acceptable
if part of the design of the implementation which means that the
application is restart/restorable (for example rerun points are recorded in shared memory).