<div dir="ltr"><div><div><div><div><div><div><div><div><div><div><div><div><br></div>Please consider the following code:<br><br>(defparameter init-a 1)<br><br>(let ((init-a 42) (serial-no 0))<br>  (defstruct foo (a init-a) (b (incf serial-no)))<br>  (defun get-foo-serial-no () serial-no))<br><br>(defstruct (bar (:include foo)) (c 33) d)<br><br></div>When one loads the above and then try to call #'make-bar the result<br></div>varies widely from one lisp implementation (clisp) to another.<br><br></div>clisp: (make-bar) --> #S(BAR :A 1 :B 1 :C 33 :D NIL)<br></div>ccl: (make-bar) --> <enter the debugger saying: "Unbound variable: SERIAL-NO"><br><br></div>lispworks, allegro and sbcl also behave more or less like ccl.<br><br></div>What is the proper ANSI-CL behavior in this case here?<br></div>Is clisp right in evaluating the slot initform in its "proper" lexical context?<br></div>Or is the correct behavior to replicate the slot initform verbatim<br>in the sub-structure constructor regardless of its original lexical context<br></div>like the others do?<br><br></div>I guess that this question has probably been asked before, in a somewhat<br></div>distant past, but my google skills have not been sharp enough to find it, sorry.<br><br><br></div>