2 possible issues in (defmethod print-object ((obj structure-object) stream) ...)
> (defstruct boo) BOO > (let ((*print-level* 0)(*print-readably nil))(write-to-string (make-boo))) "#S(BOO)" > (defstruct boo a) BOO > (let ((*print-level* 0)(*print-readably nil))(write-to-string (make-boo))) "#"
By consistency i'd expect "#" also in the first case. I believe ansi-tests PRINT-LEVEL.8 & PRINT-LEVEL.9 support that
The issue is obviously the following code:
(and slotds ;; *p-readably* effectively disables *p-level* (not *print-readably*) *print-level* (zerop *print-level*)) ´´´´ My interpretation - please check - is that slotds needs deleted here in the and problem 2: ```lisp > (defstruct foo a) FOO > (let ((*print-level* 1)) (write-to-string (make-foo :a (list (list 1 2) 2)))) "#S(FOO :A (# 2))" > (let ((*print-level* 2)) (write-to-string (make-foo :a (list (list 1 2) 2)))) "#S(FOO :A ((1 2) 2))" >
I believe that this is 1 print-lvel wrong, e.g. should print the following as it does in sbcl
"#S(FOO :A #)" "#S(FOO :A (# 2))"
A possible fix might be to decrement print-level (if set) around (prin1 sv stream as in
(if *print-level* (let ((*print-level* (1- *print-level*))) (prin1 sv stream)) (prin1 sv stream))
Provide details regarding ECL version (or preferably commit), operating system and if revelant the build options and versions of the build tools.
> (lisp-implementation-version) (ext:lisp-implementation-vcs-id)` (software-type) (software-version) (machine-type) *features* "16.1.3" > "e3b9919ffaddbeb8d5f16c394fb70b813c5f0d94" > (SOFTWARE-TYPE) > "18.0.0" > "x86_64" > (:WALKER :CDR-1 :CDR-5 :DARWIN :FORMATTER :CDR-7 :ECL-WEAK-HASH :LITTLE-ENDIAN :ECL-READ-WRITE-LOCK :LONG-LONG :UINT64-T :UINT32-T :UINT16-T :LONG-FLOAT :UNICODE :DFFI :CLOS-STREAMS :CMU-FORMAT :UNIX :ECL-PDE :DLOPEN :CLOS :THREADS :BOEHM-GC :ANSI-CL :COMMON-LISP :IEEE-FLOATING-POINT :PACKAGE-LOCAL-NICKNAMES :CDR-14 :PREFIXED-API :FFI :X86_64 :COMMON :ECL)
This corresponds to https://github.com/clasp-developers/clasp/pull/615, but the code is slighly distinct