Opened 7 years ago

Closed 7 years ago

#1082 closed defect (notabug)

wrong *print-circle* handling by format directive ~:*

Reported by: avodonosov Owned by:
Priority: normal Milestone:
Component: ANSI CL Compliance Version: trunk
Keywords: format *print-circle* Cc: avodonosov


Use case:

(setf *print-circle* t)
(format nil "~{~A ~:*~A, ~}" '("77" "88"))
=> "#1=77 #1#, #2=88 #2#, "

Expected value

=> "77 77, 88 88, "

Change History (3)

comment:1 Changed 7 years ago by gb


If you can find something in the spec that justifies your claim that what you say is expected should be expected, I'd be glad to hear it.

Implementations differ in their handling of this case. Allegro CL (as of 9.0) and CCL (at least) generate similar output; other implementations generate what you expect. I don't know of any language in the spec that makes either behavior more correct than the other. As I said, I'd be glad to be made aware of such language.

comment:2 Changed 7 years ago by avodonosov

I reported this because it was very suprising to me - there is no circularity in this structure, and #1# is not aestetic, IMHO.

BTW, I've reduced the use case to

(format nil "~A ~:*~A" "77")
 => "#1=77 #1#"

I might be wrong. My job is to report suspicious issue. Feel free to close the ticket if you think it is correct.

For my code I just use workaround: (let ((*print-circle* nil)) (format ... ))

comment:3 Changed 7 years ago by gb

  • Resolution set to notabug
  • Status changed from new to closed

Note that the spec says that *PRINT-CIRCLE* controls attempts to detect structure sharing as well as circularity. It doesn't say anything (or doesn't seem to say enough) about the granularity at which that detection is attempted.

Note: See TracTickets for help on using tickets.