Skip to content

Printing recursive objects can't be interrupted #54

Description

@dragoncoder047
(defvar x '(a))
(setf (cdr x) x)
(print x) ;; prints (a a a a a a a a ... forever until it crashes

There should be a way to mark objects during printing and then clear the mark, so that instead of printing infinitely, the above would print (a <recursive>) or something similar.

My idea for a solution:

void markobject (object *obj, bool target = true) {

Then supersub can mark each object after it prints it, and then markobject(obj, false) to clear the mark before returning. If it hits a marked object it prints <recursive> and returns without going any farther.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions