Comment 2 for bug 984813

Revision history for this message
Steve Losh (stevelosh) wrote :

For what it's worth, CLtL2 seems to agree that the user-specified names should be used. In https://www.cs.cmu.edu/Groups/AI/html/cltl/clm/node174.html there's the following example:

(defstruct (ice-cream-factory
             (:constructor fabricate-factory
               (&key (capacity 5)
                      location
                      (local-flavors
                        (case location
                          ((hawaii) '(pineapple macadamia guava))
                          ((massachusetts) '(lobster baked-bean))
                          ((california) '(ginger lotus avocado bean-sprout garlic))
                          ((texas) '(jalapeno barbecue))))
                      (flavors (subseq (append local-flavors
                                               '(vanilla chocolate strawberry pistachio maple-walnut peppermint))
                                       0 capacity)))))
  (capacity 3)
  (flavors '(vanilla chocolate strawberry mango)))

The flavors argument refers back to the capacity argument, which is also the name of a slot.

Unfortunately as far as I can tell the standard itself carefully avoids giving any explicit examples like this. The bit about the restriction on naming comes in the section where it's talking about the default keyword-style constructor function that defstruct creates, and it specifically says "THE constructor function" (emphasis mine), so I guess it could be argued it only applies to the default constructor function and not BOA constructors.