From: Alberto Lavelli
Subject: ~S FORMAT directive
Date: 
Message-ID: <agbi6f$lr2$1@fe1.cs.interbusiness.it>
Hi all,

I don't understand the behaviour of the ~S FORMAT directive in a very
specific case in Allegro CL (the behaviour is the same in both version
5.0.1 and version 6.1 of ACL). As a matter of fact, the behaviour is
probably not specific to FORMAT but I ran into it when using this
function and so I use examples with FORMAT.  I browsed the CL
HyperSpec but I was not able to understand the reasons of the
behaviour and if ACL is correct or not. The problematic case is the
first listed below, while the other two are provided to contrast with
cases that should be similar (at least in my understanding):

> (format t "~S" '|..|)
..
NIL

> (format t "~S" '|.|)
\.
NIL

> (format t "~S" '|''|)
|''|
NIL


I was wondering why in the first example ACL doesn't write |..|.


Why I'm trying to do this? The examples above are simplified instances
of the problem I ran into.  I want to write a s-expr on file (and load
it later when running other lisp sessions).  This s-expr contains
lists of structures and one slot of such structures contains as filler
a symbol. If the symbol is '|..|, when I write it (using format with a
~S directive) on file ACL writes

  '..

and I'm no longer able to load the file back in the lisp image. 
When I try to load the file, the error message is:

Error: Too many dots. [file position = 2372324]
  [condition type: READER-ERROR]


I tried the examples above with CLISP (an old version, from 1999, if
I'm not wrong) and they work as I would expect.

Which is the correct behaviour according to ANSI CL?


best
	alberto
From: Joe Marshall
Subject: Re: ~S FORMAT directive
Date: 
Message-ID: <CVeW8.326106$6m5.325416@rwcrnsc51.ops.asp.att.net>
"Alberto Lavelli" <·······@irst.it> wrote in message ·················@fe1.cs.interbusiness.it...
>
> Hi all,
>
> I don't understand the behaviour of the ~S FORMAT directive in a very
> specific case in Allegro CL (the behaviour is the same in both version
> 5.0.1 and version 6.1 of ACL). As a matter of fact, the behaviour is
> probably not specific to FORMAT but I ran into it when using this
> function and so I use examples with FORMAT.  I browsed the CL
> HyperSpec but I was not able to understand the reasons of the
> behaviour and if ACL is correct or not. The problematic case is the
> first listed below, while the other two are provided to contrast with
> cases that should be similar (at least in my understanding):
>
> > (format t "~S" '|..|)
> ..
> NIL
>
> > (format t "~S" '|.|)
> \.
> NIL
>
> > (format t "~S" '|''|)
> |''|
> NIL
>
>
> I was wondering why in the first example ACL doesn't write |..|.

It should.  The ~S directive
  `binds *print-escape* to t'  (section 22.3.4.2)

and when *print-escape* is t, symbols should be escaped as
necessary (section 22.1.1.3)