[Ecls-list] [PATCH] Fix the value of the print-function depth parameter in defstruct.

Alexander Gavrilov angavrilov at gmail.com
Sat Sep 19 12:41:51 UTC 2009

From the Common Lisp HyperSpec:

  It is implementation-dependent whether <<current-print-depth>>
  is always 0 and *print-level*, if non-nil, is re-bound to
  successively smaller values as printing descends recursively,
  or whether current-print-depth varies in value as printing
  descends recursively and *print-level* remains constant during
  the same traversal.

ECL modifies *print-level*, so the value should be 0. And in
no case should it be unconditionally set to *print-level*.

	This is necessary to make FSet containers print properly.

	- Alexander

 src/lsp/defstruct.lsp |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/lsp/defstruct.lsp b/src/lsp/defstruct.lsp
index 40f78d9..de01954 100644
--- a/src/lsp/defstruct.lsp
+++ b/src/lsp/defstruct.lsp
@@ -294,7 +294,7 @@
   (when print-function
     (eval `(defmethod print-object ((obj ,name) stream)
-	     (,print-function obj stream *print-level*))))
+	     (,print-function obj stream 0))))
   (when print-object
     (eval `(defmethod print-object ((obj ,name) stream)

More information about the ecl-devel mailing list