A KnowledgeWorks CLOS class may not have a class name which coincides with any rule, context or KnowledgeWorks structure (See KnowledgeWorks Structures). KnowledgeWorks CLOS classes fall into one of two categories, either unnamed or named. Named objects can be given a name (or they use a default name) and can be referred to by name. Otherwise, named and unnamed objects have equivalent functionality. CLOS objects may be made by the Common Lisp function
make-instance, taking the same arguments. An unbound slot will return
:unbound until set.
Name clashes are arbitrated by *signal-kb-name-clash* and signal an error by default. See the reference manual page.
Unnamed classes may be defined by the macro def-kb-class which takes the same arguments as the
defclass macro. It is identical to using defclass and supplying the KnowledgeWorks mixin standard-kb-object if none of the superclasses already contains it. The function
make-instance may be used to create instances of the class.
A named KnowledgeWorks CLOS class is defined by the macro def-named-kb-class which is syntactically identical to the Common Lisp
defclass macro, and semantically identical with the exception that it adds a KnowledgeWorks mixin class named-kb-object if none of the superclasses already contains it, and makes the default name for the objects be a symbol generated from the class name. Classes defined by def-named-kb-class contain a name slot which those defined by def-kb-class do not.
make-instance can be given the initialization argument
:kb-name to specify a name. If not specified, a default name is generated from the name of the class. All names must be distinct as regarded by
eq. The function
(make-instance 'truck :location 'London)
(kb-name (get-kb-object 'ford1))
(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
KnowledgeWorks and Prolog User Guide (Macintosh version) - 24 Mar 2017