Clozure / ccl

Clozure Common Lisp
http://ccl.clozure.com
Apache License 2.0
849 stars 103 forks source link

*print-circle* and FORMAT #96

Open olopierpa opened 6 years ago

olopierpa commented 6 years ago

Hello,

I would like to resuscitate this old issue: https://trac.clozure.com/ccl/ticket/1389

GB asked for evidence in the spec supporting the opinion that CCL is wrong in this case.

Steve Haflich showed some evidence here: https://mailman.common-lisp.net/pipermail/pro/2017-December/001581.html , and his analysis looks pretty solid to me.

(Privately he also confirmed that the same behavior in ACL is a mistake he made, and should be fixed in ACL too).

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/53028751-print-circle-and-format?utm_campaign=plugin&utm_content=tracker%2F27935804&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F27935804&utm_medium=issues&utm_source=github).
xrme commented 6 years ago

I think I'm convinced, but language lawyering at this level makes my head spin.

xrme commented 6 years ago

The claim here is that the following output is correct (and required by the standard) when *print-circle* is true.

* (let ((g "a")) (format nil "~a ~a" g g))
"a a"
* (let ((g "a")) (format nil "~a" (list g g)))
"(#1=a #1#)"
* (let ((g "a")) (format nil "~{~a ~}" (list g g)))
"a a "

CCL generates the following (again, when *print-circle* is true):

? (let ((g "a")) (format nil "~a ~a" g g))
"#1=a #1#"
? (let ((g "a")) (format nil "~a" (list g g)))
"(#1=a #1#)"
? (let ((g "a")) (format nil "~{~a ~}" (list g g)))
"#1=a #1# "