-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pretty-print Not Honoring ~:@_ Directive #4
Comments
The issue appears to be with with (setf *print-pretty* t)
(with-output-to-string (out)
(princ "a" out)
(pprint-newline :mandatory out)
(princ "b" out))
;; => "ab" This happens in SBCL, CLISP, ECL, ABCL as well so we should check that the standard indeed mandates a newline to be inserted. Althought it is certainly my impression that that is the case the following part on the CLHS entry on pprint-newline raises an eyebrow
|
From CLtL2: "If kind is :mandatory, it specifies a `mandatory-style' conditional newline. A line break is always inserted. This implies that none of the containing sections can be printed on a single line and will therefore trigger the insertion of line breaks at linear-style conditional newlines in these sections." emphasis is mine. |
From CLHS pprint-newline: From CLHS glossary: pretty printing stream: So since there is no (with-output-to-string (out)
(pprint-logical-block (out nil)
(format out "~:@_FAILURE DETAILS:~:@_~4:I================")
(princ "a" out)
(pprint-newline :mandatory out)
(princ "b" out)))
;; =>
"
FAILURE DETAILS:
================a
b"
;; or
;; I don't think an argument should be required with ~@< ~:>, but ccl complains
(format nil "~@<~:@_FAILURE DETAILS:~:@_~4:I================~:>" nil)
;; =>
"
FAILURE DETAILS:
================" |
To see this error:
As I read the CLHS, section 22.3, the
~:@_
directive is equivalent to a mandatory newline (i.e.~%
), but that’s not the case here.http://www.lispworks.com/documentation/HyperSpec/Body/22_cea.htm
The text was updated successfully, but these errors were encountered: