Bug #308948 reported by Nikodemus Siivola on 2008-12-17
Affects Status Importance Assigned to Milestone

Bug Description

  In sbcl-,
    (defparameter *c*
      (make-condition 'simple-error
                      :format-control "ow... ~S"
                      :format-arguments '(#1=(#1#))))
    (setf *print-circle* t *print-level* 4)
    (format nil "~@<~A~:@>" *c*)
    "ow... (((#)))"
  where I (WHN) believe the correct result is "ow... #1=(#1#)",
  like the result from (PRINC-TO-STRING *C*). The question of
  what the correct result is is complicated by the hairy text in
  the Hyperspec " Tilde Less-Than-Sign: Logical Block",
    Other than the difference in its argument, ~@<...~:> is
    exactly the same as ~<...~:> except that circularity detection
    is not applied if ~@<...~:> is encountered at top level in a
    format string.
  But because the odd behavior happens even without the at-sign,
    (format nil "~<~A~:@>" (list *c*)) ; => "ow... (((#)))"
  and because something seemingly similar can happen even in
  PPRINT-LOGICAL-BLOCK invoked directly without FORMAT,
    (pprint-logical-block (*standard-output* '(some nonempty list))
      (format *standard-output* "~A" '#1=(#1#)))
  (which prints "(((#)))" to *STANDARD-OUTPUT*), I don't think
  that the trickiness is fundamental to the problem.

  My guess is that the problem is related to the logic around the MODE
  argument to CHECK-FOR-CIRCULARITY, but I haven't reverse-engineered
  enough of the intended meaning of the different MODE values to be
  confident of this.

Changed in sbcl:
importance: Undecided → Medium
status: New → Confirmed
Nikodemus Siivola (nikodemus) wrote :

Addenda: TRACE confuses circularity detection -- which doesn't exactly make it easier to understand what is going on.

Changed in sbcl:
status: Confirmed → Triaged
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers