wanted: readable printing for specialized arrays

Bug #803665 reported by Robert Brown
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Fix Released
Medium
Unassigned

Bug Description

When I evaluate the following with SBCL

  (defvar *f* (make-array 10 :element-type '(unsigned-byte 8)))
  (with-standard-io-syntax (print *f*))

a PRINT-NOT-READABLE condition is signaled. Other Common Lisp
implementations allow readable printing of specialized arrays:

CLISP outputs

  #A((|COMMON-LISP|::|UNSIGNED-BYTE| 8.) (10.) (0. 0. 0. 0. 0. 0. 0. 0. 0. 0.))

Lispworks outputs

  #.(COERCE #(252 140 140 245 0 0 0 0 123 86)'(SIMPLE-ARRAY (UNSIGNED-BYTE 8) (10)))

I would like something similar for SBCL. CLISP's extension of the #A
reader macro looks pretty reasonable. Are there any hidden issues
with implementing this array reading extension in SBCL as well?

bob

====================

paradicsom [23645] sbcl --version
SBCL 1.0.49.62-99a669b

paradicsom [23646] uname -a
Linux paradicsom.nyc.corp.google.com 2.6.32-gg508-generic #gg508-Ubuntu SMP
Tue May 24 05:09:12 PDT 2011 x86_64 GNU/Linux

Tags: feature
Revision history for this message
Robert Brown (robert-brown) wrote : Re: [Bug 803665] [NEW] readable printing for specialized arrays
  • diff Edit (7.8 KiB, application/octet-stream; name=diff)

Attached is a patch against SBCL 1.0.52 that implements readable printing
for specialized arrays.

Would someone be willing to review this change?

bob

Changed in sbcl:
assignee: nobody → Nikodemus Siivola (nikodemus)
importance: Undecided → Medium
status: New → Triaged
summary: - readable printing for specialized arrays
+ wanted: readable printing for specialized arrays
tags: added: feature review
Revision history for this message
Robert Brown (robert-brown) wrote :

Updated patch.

Changed in sbcl:
status: Triaged → In Progress
Revision history for this message
Robert Brown (robert-brown) wrote :

Updated patch for recent printing changes.

Revision history for this message
Nikodemus Siivola (nikodemus) wrote :
Revision history for this message
Nikodemus Siivola (nikodemus) wrote :

Nothing this here, so it won't get lost.

I think we should also add *print-portably*, defaulting to T.

When it is bound to NIL we could print base-strings as #"foo" and specialized arrays as #A(simple-array <dims> <etype> <contents>), similar to CMUCL (regardless of the value of *print-readably*.)

Then we could also add PRINT-UNPORTABLY restart.

Revision history for this message
Nikodemus Siivola (nikodemus) wrote :

commit 628c9c353690b012965ccd74d68e1b81e4a2a368
Author: Robert Brown <email address hidden>
Date: Fri Dec 2 17:07:20 2011 +0200

    printing specialized arrays readably

      When *READ-EVAL* is true, use #. based syntax to print them.

      lp#803665.

Changed in sbcl:
assignee: Nikodemus Siivola (nikodemus) → nobody
status: In Progress → Fix Committed
tags: removed: review
Changed in sbcl:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.