(def-named-kb-class truck ()
((location :initarg :location)
(destination :initarg :destination)))
(make-instance 'truck
:kb-name 'ford1
:location 'cambridge)
creates the instance
#<KB-OBJECT FORD1>
.
(make-instance 'truck :location 'london)
creates the instance
#<KB-OBJECT TRUCK123>
, and
(get-kb-object 'ford1)
returns
#<KB-OBJECT FORD1>
and
(kb-name (get-kb-object 'ford1))
returns
FORD1
. The class definition
(defclass truck (named-kb-object) ...)
would have been identical except that the second truck would have been given a name such as
OBJECT345
rather than
TRUCK123
(as def-named-kb-class overrides the inherited initform for the
kb-name
slot
(gentemp "OBJECT")
with a more specific one
(gentemp <class-name>)
).