[prev in list] [next in list] [prev in thread] [next in thread]
List: sbcl-help
Subject: Re: [Sbcl-help] Surprising *print-readably* behavior.
From: Douglas Katzman via Sbcl-help <sbcl-help () lists ! sourceforge ! net>
Date: 2021-01-31 22:26:18
Message-ID: CAOrNasygk2J90Dd6zot_XB=dDHavZUqODE9y0rQMTQgwN-af+g () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
The spec is pretty fubar as pertains to string I/O in general, and
pathnames in particular, hence the extra noise to have perfectly readable
pathnames.
The specified bindings of *print-escape*, *print-array*, *print-gensym* etc
are necessary but not sufficient.
That is, *print-readably* *assures* readability (print/read round-tripping
perfectly) and if it can not be achieved, then errs.
Binding the variables separately does not assure readability; the result
*might* be readable, and probably is, but is not perfectly round-trippable.
On Sun, Jan 31, 2021 at 4:48 PM Matt Kaufmann <kaufmann@cs.utexas.edu>
wrote:
> Hi,
>
> The page
>
> http://www.lispworks.com/documentation/HyperSpec/Body/v_pr_rda.htm#STprint-readably
> states the following.
>
> Specifically, if *print-readably* is true, printing proceeds as if
> *print-escape*, *print-array*, and *print-gensym* were also true,
> and as if *print-length*, *print-level*, and *print-lines* were
> false.
>
> However, I got the following behavior in SBCL 2.1.1 built from source
> on Ubuntu Linux, which seems to suggest a bug since it contradicts the
> sentence above. If not a bug, then I'd appreciate any clarifying
> explanation.
>
> eld:/projects/acl2/acl2-temp%
> /projects/acl2/lisps/sbcl/sbcl-2.1.1/run-sbcl.sh
> This is SBCL 2.1.1, an implementation of ANSI Common Lisp.
> More information about SBCL is available at <http://www.sbcl.org/>.
>
> SBCL is free software, provided as is, with absolutely no warranty.
> It is mostly in the public domain; some portions are provided under
> BSD-style licenses. See the CREDITS and COPYING files in the
> distribution for more information.
> * (let ((*print-readably* t))
> (format t "Here: ~s~%" (namestring (truename (car
> sb-ext:*posix-argv*)))))
> Here: #A((62) BASE-CHAR
> .
> "/v/filer5b/v11q001/acl2/lisps/sbcl/sbcl-2.1.1/src/runtime/sbcl")
> NIL
> * (let ((*print-readably* nil)
> (*print-escape* t)
> (*print-array* t)
> (*print-gensym* t)
> (*print-length* nil)
> (*print-level* nil)
> (*print-lines* nil))
> (format t "Here: ~s~%" (namestring (truename (car
> sb-ext:*posix-argv*)))))
> Here: "/v/filer5b/v11q001/acl2/lisps/sbcl/sbcl-2.1.1/src/runtime/sbcl"
> NIL
> *
>
> By the way, I had some older versions of SBCL lying around, and I
> found that for the (let ((*print-readably* t)) ...) form above,
> version 1.3.5 just prints a string (as I'd expect, like the second
> example above), but version 1.3.9 prints a fancier expression
> (however, different from the output for the first example above).
>
> Thanks,
> Matt Kaufmann
>
>
> _______________________________________________
> Sbcl-help mailing list
> Sbcl-help@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/sbcl-help
>
[Attachment #5 (text/html)]
<div dir="ltr">The spec is pretty fubar as pertains to string I/O in general, and \
pathnames in particular, hence the extra noise to have perfectly readable \
pathnames.<div>The specified bindings of *print-escape*, *print-array*, \
*print-gensym* etc are necessary but not sufficient.<div>That is, *print-readably* \
<i>assures</i> readability (print/read round-tripping perfectly) and if it can not be \
achieved, then errs.</div><div>Binding the variables separately does not assure \
readability; the result <i>might</i> be readable, and probably is, but is not \
perfectly round-trippable.</div><div></div></div></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">On Sun, Jan 31, 2021 at 4:48 PM \
Matt Kaufmann <<a \
href="mailto:kaufmann@cs.utexas.edu">kaufmann@cs.utexas.edu</a>> \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br> <br>
The page<br>
<a href="http://www.lispworks.com/documentation/HyperSpec/Body/v_pr_rda.htm#STprint-readably" \
rel="noreferrer" target="_blank">http://www.lispworks.com/documentation/HyperSpec/Body/v_pr_rda.htm#STprint-readably</a><br>
states the following.<br>
<br>
Specifically, if *print-readably* is true, printing proceeds as if<br>
*print-escape*, *print-array*, and *print-gensym* were also true,<br>
and as if *print-length*, *print-level*, and *print-lines* were<br>
false.<br>
<br>
However, I got the following behavior in SBCL 2.1.1 built from source<br>
on Ubuntu Linux, which seems to suggest a bug since it contradicts the<br>
sentence above. If not a bug, then I'd appreciate any clarifying<br>
explanation.<br>
<br>
eld:/projects/acl2/acl2-temp% /projects/acl2/lisps/sbcl/sbcl-2.1.1/run-sbcl.sh<br>
This is SBCL 2.1.1, an implementation of ANSI Common Lisp.<br>
More information about SBCL is available at <<a href="http://www.sbcl.org/" \
rel="noreferrer" target="_blank">http://www.sbcl.org/</a>>.<br> <br>
SBCL is free software, provided as is, with absolutely no warranty.<br>
It is mostly in the public domain; some portions are provided under<br>
BSD-style licenses. See the CREDITS and COPYING files in the<br>
distribution for more information.<br>
* (let ((*print-readably* t))<br>
(format t "Here: ~s~%" (namestring (truename (car \
sb-ext:*posix-argv*)))))<br>
Here: #A((62) BASE-CHAR<br>
. "/v/filer5b/v11q001/acl2/lisps/sbcl/sbcl-2.1.1/src/runtime/sbcl")<br>
NIL<br>
* (let ((*print-readably* nil)<br>
(*print-escape* t)<br>
(*print-array* t)<br>
(*print-gensym* t)<br>
(*print-length* nil)<br>
(*print-level* nil)<br>
(*print-lines* nil))<br>
(format t "Here: ~s~%" (namestring (truename (car \
sb-ext:*posix-argv*)))))<br>
Here: "/v/filer5b/v11q001/acl2/lisps/sbcl/sbcl-2.1.1/src/runtime/sbcl"<br>
NIL<br>
* <br>
<br>
By the way, I had some older versions of SBCL lying around, and I<br>
found that for the (let ((*print-readably* t)) ...) form above,<br>
version 1.3.5 just prints a string (as I'd expect, like the second<br>
example above), but version 1.3.9 prints a fancier expression<br>
(however, different from the output for the first example above).<br>
<br>
Thanks,<br>
Matt Kaufmann<br>
<br>
<br>
_______________________________________________<br>
Sbcl-help mailing list<br>
<a href="mailto:Sbcl-help@lists.sourceforge.net" \
target="_blank">Sbcl-help@lists.sourceforge.net</a><br> <a \
href="https://lists.sourceforge.net/lists/listinfo/sbcl-help" rel="noreferrer" \
target="_blank">https://lists.sourceforge.net/lists/listinfo/sbcl-help</a><br> \
</blockquote></div>
_______________________________________________
Sbcl-help mailing list
Sbcl-help@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sbcl-help
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic