#117 closed defect (fixed)
printing of circular objects does not terminate when shown by `describe'
Reported by: | felix winkelmann | Owned by: | Christian Kellermann |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | core tools | Version: | 4.5.x |
Keywords: | csi describe | Cc: | |
Estimated difficulty: |
Description
In csi
, describing an object containing circular data will result in non-termination.
Attachments (2)
Change History (11)
comment:1 Changed 15 years ago by
Milestone: | 4.3.0 |
---|
comment:2 Changed 15 years ago by
Owner: | set to Christian Kellermann |
---|---|
Status: | new → accepted |
comment:3 Changed 15 years ago by
Owner: | changed from Christian Kellermann to felix winkelmann |
---|---|
Status: | accepted → assigned |
comment:4 Changed 15 years ago by
Thanks! Added in e6eb2d2 (exp.).
Note thar this will still fail:
#;> (define x '(1)) #;> (set-car! x x)
comment:5 Changed 15 years ago by
Keywords: | csi describe added |
---|---|
Milestone: | → 4.6.0 |
Version: | 4.2.x → 4.5.x |
comment:6 Changed 15 years ago by
Owner: | changed from felix winkelmann to Christian Kellermann |
---|
I am not sure about the best way to fix this. There are at least two ways I see:
- Extend circular-list? to detect circular cars
- Add checks for the list? and pair? cases, which would mean to either a) extend descseq and make the pair? case use that b) make a standalone check procedure and have that used also by descseq
so basically this would work the same as the code I have proposed for circular lists:
Collect all car's and check that the car's are not eq?.
comment:7 Changed 15 years ago by
The circular.patch (attached) works on lists that have its car pointing somwhere inside itself as well as its cdr (and both).
comment:8 Changed 15 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
Excellent. Patch is applied in 82881d88cfbf6124b83952a2482efa46a7afd59d (exp.).
Thanks!
Note: See
TracTickets for help on using
tickets.
Ok, testcases:
(define p '( a . b))
(set! (cdr p) p)
(define l (cons 'c p))
With the patch:
#;1> ,d l
circular list: c -> a -> a (circle)
#;2> ,d p
circular list: a -> a (circle)
I think, that this does ease the situation, although there might be cases where this does not do the right thing?