[armedbear-devel] SLOT-VALUE and SLOT-VALUE-USING-CLASS with DEFSTRUCT
Tobias C Rittweiler
tcr at freebits.de
Fri Jun 18 04:41:18 UTC 2010
> I committed (r12756) a simple implementation of SLOT-VALUE and friends
> (setf slot-value, slot-boundp, slot-makunbound) for structures. It
> searches for slots by iterating through the list of slot names stored
> in the structure-class, which is probably not very good
> performance-wise (CLOS objects use a map). Structure slots are
> initialized to NIL and can't be unbound, and
> slot-boundp/slot-makunbound reflect this.
> I also added the necessary autoloads to autoloads.lisp.
Regarding the initialization, this is not quite true; CLHS
If a slot is not initialized in this way, it is initialized by
evaluating slot-initform in the slot description at the time the
constructor function is called. If no slot-initform is supplied, the
consequences are undefined if an attempt is later made to read the
slot's value before a value is explicitly assigned.
As consequences are undefined, always returning NIL is compliant,
but you could also make it signal an error, and make SLOT-BOUNDP
cover this case.
More information about the armedbear-devel