[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

defstruct slots' default-inits



Is the following legal CL:

(defstruct foo
  (a 1)
  (b (+ a 2)))

Specifically, is the default-init form of a slot allowed to reference the
values of slots to its left (above)?  In other words, is the above
defined by CL to be equivalent to

(defstruct (foo (:constructor make-foo (&key (a 1) (b (+ a 2)))))
  a
  b)

(assuming that &key was allowed in the lambda-list for a BOA
constructor)

The only hint that I can find that indicates that it is legal is on
page 309 (bottom): "It is as if the initialization forms were used as
init forms for the keyword parameters of the constructor function."

Is there a more direct statement about the interaction of default-init
forms and other slots?  If not, there should be.

-- Nick