[Openmcl-devel] Format bug?

Waldek Hebisch hebisch at math.uni.wroc.pl
Fri Jan 6 11:21:43 PST 2012


Gary Byers wrote:
> 
> 
> 
> On Thu, 5 Jan 2012, Waldek Hebisch wrote:
> 
> > $ scripts/ccl64
> > Welcome to Clozure Common Lisp Version 1.8-dev-r15159M-trunk  (LinuxX8664)!
> > ? (setf *print-circle* t)
> > T
> > ? (setf ll '(#1="PrimeField" #2="(" #1# #2# "x" ")" ")"))
> > (#1="PrimeField" #2="(" #1# #2# "x" ")" ")")
> > ? (FORMAT nil "~{~A~}" ll)
> > "#1=PrimeField#2=(#1##2#x))"
> > ?
> >
> > HypeSpec says that ~A should just use string "as is"
> 
> It does ?
> 
> The spec says a few things about ~A (and about PRINC), but none of
> them seem to use the term "as is."  It does say that ~A will print its
> argument without escape characters (and that it binds *PRINT-ESCAPE*
> and *PRINT-READABLY* to NIL), and that certain modifiers control how
> NIL is printed and control justifcation and padding.  None of this 
> is defined to have any effect on whether or how *PRINT-CIRCLE* introduces
> #n=/#n# syntax.

>From HyperSpec:

: 22.3.4.1 Tilde A: Aesthetic
:
: An arg, any object, is printed without escape characters (as by princ).
: If arg is a string, its characters will be output verbatim.
 
> The spec also says quite a bit about how *PRINT-CIRCLE* affects
> printing; none of what it says indicates that *PRINT-ESCAPE* or
> *PRINT-READABLY affect what *PRINT-CIRCLE* does.  Unfortunately, some
> aspects of what *PRINT-CIRCLE* does - notably, the "extent" over which
> circularity/sharing detection is performed - are left unstated, and
> implementations differ in this regard.
> 

Well, looking at the letter of HyperSpec you are right.  But
the intent of sharing detection (as opposed to merely detectiong
circularity) is print/read equivalence.  This looses sense when
printing separate objects.  So doing circularity detection
for each toplevel object separately seems to match the intent.

-- 
                              Waldek Hebisch
hebisch at math.uni.wroc.pl 



More information about the Openmcl-devel mailing list