next up previous

Appendix D Differences Between Versions 5.1 and 6.0

Numerous changes and additions to CLIPS were made between version 5.1 and the version 6.0. The primary additions were:

ï Rule/Object Integration: Instances of userdefined classes in COOL can be patternmatched on the lefthand side of rules. For more information, see sections,,, 9.6.1, 9.6.2, 9.6.6, 9.6.7, and 9.6.8.

ï Defmodule Construct: The defmodule construct allows a knowledge base to be partioned. For more information, see section 10.

ï New Conditional Elements: Not CEs may now contain CEs other than CEs. The and CEs have been added. The initial-fact or initial-object pattern is added to rules which begin with a not or test CE. Connective constraints can be used with multifield variables. For more information, see sections 5.4.2, 5.4.5, 5.4.6, 5.4.7, and 5.4.9.

ï Constraint Checking: Static and dynamic constraint checking are supported to a much greater extent than in CLIPS 5.1. In addition to deftemplates, COOL also performs constraint checking. Many of the features previously available in CRSV are now directly supported in CLIPS. For more information, see sections 10, 13.1.13, 13.1.14, 13.1.15, and 13.1.16.

ï Deftemplate Enhancements: Deftemplates can now contain more than one multifield slot. For more information, see section 3.

ï Defclass Syntax The syntax for the defclass construct has been considerably changed. The primary changes in the syntax are:

1) The abstract/concrete behavior of a clsass is now inherited if not explicitly specified (rather than defaulting to concrete). Since the system class USER is abstract, many class declarations from 5.1 code will have to be explicitly declared concrete.

2) All facets must be specified with name and value (rather than just value as in 5.1). For example, to declare a read-only slot now requires ì(access readonly)î rather than ì(readonly)î.

3) The ìsingleî and ìmultipleî facets have been removed. This information is now conveyed by the declaration of the slot: ì(slot ...)î and ì(singleslot ...)î are singlefield slots and ì(multislot ...)î is a multifield slot.

For more information, see section 9.3.

ï Windows 3.1 Interface and Extended Memory A Windows 3.1 CLIPS interface is now available for PC compatible computers. See the section 2 of The Interfaces Guide for more details. In addition, MSDOS 286 and 386 versions of CLIPS are available which can use extended memory.

Minor Changes

ï Sequence Expansion The $ symbol can now be used to expand the values contained within a multifield variable when calling a function such than multiple arguments are passed to the function rather than a single multifield argument. For more information, see section 12.18.

ï Generic Function Changes

ï Restrictions on Defmethod Wildcard Parameters Generic function method wildcard parameters can now be restricted with types and queries similarly to the regular parameters. For more information, see section 8.4.

ï Overloading System Functions If a system function is overloaded with a defgeneric, it is no longer automatically applicable with lowest precedence to a call to that generic function. An explicit method is formed for the system function corresponding to its BNF syntax restrictions. This method is used to determine the applicability and precedence of the system function to the generic function call. For more information, see section 8.5.1.

ï COOL Changes

ï New COOL Predefined System Classes - There are a number of new predefined COOL system classes. They are INSTANCE, INSTANCEADDRESS, INSTANCENAME, ADDRESS, FACTADDRESS, EXTERNALADDRESS. See section 9.2 for more details.

ï Class Descriptors The abstract/concrete class descriptors are now inherited (see section This implies that any classes which directly inherit from the abstract system class USER must now explicitly specify the concrete role in order to have direct instances. The reactive and nonreactive class descriptors can be used to indicate which classes will match object patterns (see section

ï Unbound Slots COOL object slots are no longer allowed to be unbound. The function slotboundp has been removed.

ï New Slot Facets - Several new facets are available for slots: patternmatch, visibility, createaccessor and overridemessage (see section 9.3.3).

ï Implicit SlotAccessors - Implicit slotaccessor messagehandlers are no longer created for all slots in a defclass. The createaccessor slot facet can be used to automatically generate explicit messagehandlers for accessing the slotís value (see section

ï Accessing Slot Values - The bind function can directly set a slot's value from within a messagehandler's body (see section 9.4.2). The visibility facet can be used to restrict access to a slot to messagehandlers attached to the class in which the slot is defined (see section Direct slot references of the form ?self:<slotname> are now statically bound when the messagehandler is parsed (see section 9.4.2). The functions dynamicput and dynamicget provide the previous behavior. In addition, the syntax ?self:<variable> is no longer allowed.

ï Return and Break from InstanceSet Queries - The return and break functions can be used within certain instance set query functions (see sections 9.7.7, 12.6.7, and 12.6.8).

ï Default Values for Instance Slots (see section

ï MessageHandlers for Redefined Classes - Messagehandlers attached to a class are now deleted when the class is redefined rather than being attached to the new definition (see section 9.3). This is because messagehandlers can contain static references to slots within the defclass (see section 9.4.2).

ï Definstances Definition Order Dependence - Definstances can now only use classes which have been previously defined (see section

ï New Functions for Setting Groups of Slots - Functions are provided for quickly changing a group of slots in an instance and duplicating an instance (see sections 9.6.7 and 9.6.8 ).

ï Watch Enhancements The watch and unwatch commands have been extended to allow individual constructs to be watched (see sections 13.2.3 and 13.2.4) The listwatchitems command allows the current state of watch items to be viewed (see section 13.2.5).

ï Deftemplate Syntax For consistency, the keyword multislot should be used in place of the keyword multifield when defining multifield slots and the keyword slot should be used in place of the keyword field when defining single field slot. The keywords multifield and field are still supported, but should be considered archaic. For more information, see section 3.

ï Default Values The use of the ?NONE keyword and the nodefault facet for specifying default values has been changed. See sections 3.1, 9.3, and

ï Different Feature Behavior - A number of features now behave differently. They are:

allowedinstances (see section 11.2)

allowednumbers (see section 11.2)

maxnumberoffields (see section 11.4)

minnumberoffields (see section 11.4)

ï Assert and the Return Value Constraint - The return value constraint is no longer needed to evaluate expressions contained within an assert, modify, or duplicate command. See sections 12.9.1, 12.9.3, 12.9.4, and for more details.

ï First Field of a Fact or Pattern Must be a Symbol - The first field of any fact (whether it is an ordered or template fact) or pattern must be a symbol (see sections and 5.4.1).

ï Format % ld option - The % d option for the format function now prints all integers using a long integer format. The % ld option is no longer required to print integers in this format.

ï Bind Function Changes - The bind function can now be used to set the value of slots within messagehandlers. By passing no arguments after the variable name, local variables can be unbound and global variables can be reset to their original value. Passing more than one value after the variable name automatically appends all of the arguments together as a multifield value. For more information, see section 12.6.1.

ï Instance Statistics - The average number of instances is now displayed after a run command if statistics are being watched.

ï Defrelation and Defexternal Constructs are No Longer Supported - The defexternal and defrelation constructs previously provided for use with CRSV are no longer supported.

ï Connective Constraints can be used with Multifield Variables Connective constraints can now be used with multifield variables. See section 5.4.1 for more details.

ï Default Values for Deftemplates The defaults values for deftemplates have been enhanced. The ?NONE keyword should be replaced with ?DERIVE. See section 3.1 for more details.

ï New Functions and Commands A number of new functions and commands have been added. They are:

activeduplicateinstance (see section

activeinitializeinstance (see section 9.6.2)

activemakeinstance (see section 9.6.1)

activemessageduplicateinstance (see section

activemessagemodifyinstance (see section

apropos (see section 13.11.17)

bloadinstances (see section

bsaveinstances (see section

callspecificmethod (see section 12.15.8)

classreactivep (see section

clearfocusstack (see section 13.7.8)

defclassmodule (see section

deffactsmodule (see section 12.10.2)

deffunctionmodule (see section 12.14.2)

defgenericmodule (see section 12.15.2)

defglobalmodule (see section 12.13.2)

definstancesmodule (see section

defrulemodule (see section 12.11.2)

deftemplatemodule (see section 12.8.2)

duplicateinstance (see section

first$ (see section 12.2.11)

focus (see section 13.7.3)

getcurrentmodule (see section 12.17.3)

getdefclasslist (see section

getdeffactslist (see section 12.10.1)

getdeffunctionlist (see section 12.14.1)

getdefgenericlist (see section 12.15.1)

getdefgloballist (see section 12.13.1)

getdefinstanceslist (see section

getdefmessagehandlerlist (see section

getdefmethodlist (see section 12.15.3)

getdefmodulelist (see section 12.17.1)

getdefrulelist (see section 12.11.1)

getdeftemplatelist (see section 12.8.1)

getfocus (see section 12.12.1)

getfocusstack (see section 12.12.2)

getfunctionrestrictions (see section 12.7.8)

getmethodrestrictions (see section 12.15.9)

getsequenceoperatorrecognition (see section 12.18.4)

insert$ (see section 12.2.10)

listdefmodules (see section 13.12.2)

listfocusstack (see section 13.7.7)

loopforcount (see section 12.6.4)

messageduplicateinstance (see section

messagemodifyinstance (see section

modifyinstance (see section

objectpatternmatchdelay (see section 9.6.6)

overridenextmethod (see section 12.15.7)

popfocus (see section 12.12.3)

ppdefmodule (see section 13.12.1)

progn$ (see section 12.6.6)

remove (see section

rename (see section

replace$ (see section 12.2.9)

rest$ (see section 12.2.12)

restoreinstances (see section

setcurrentmodule (see section 12.17.2)

setsequenceoperatorrecognition (see section 12.18.3)

showdefglobals (see section 13.8.4)

slotallowedvalues (see section

slotcardinality (see section

slotdirectaccessp (see section

slotpublicp (see section

slotrange (see section

slottypes (see section

subseq$ (see section 12.2.8)

switch (see section 12.6.9)

undefglobal (see section 13.8.3)

ï Obsolete Functions The following functions are considered obsolete, but are still supported. They should be replaced with the specified functions.

strassert (use assertstring instead)

directmvdelete (use directslotdelete$ instead)

directmvinsert (use directslotinsert$ instead)

directmvreplace (use directslotreplace$ instead)

get (use dynamicget or ?self:<name> syntax instead)

member (use member$ instead)

mvappend (use create$ instead)

mvdelete (use delete$ instead)

mvreplace (use replace$ instead)

mvslotdelete (use slotdelete$ instead)

mvslotinsert (use slotinsert$ instead)

mvslotreplace (use slotreplace$ instead)

mvsubseq (use subseq$ instead)

nth (use nth$ instead)

put (use dynamicput or (bind ?self:<name> <value>*) syntax instead)

strexplode (use explode$ instead)

strimplode (use implode$ instead)

subset (use subsetp instead)

The following functions are considered obsolete and are no longer supported. They should be replaced with the specified functions.

classmessagehandlerexistp (use messagehandlerexistp instead)

classmessagehandlers (use getdefmessagehandlerlist instead)

classslotexistp (use slotexistp instead)

getdynamicdeftemplatechecking (use getdynamicconstraintchecking instead)

setdynamicdeftemplatechecking (use setdynamicconstraintchecking instead)

trunc (use integer instead)

The following functions are considered obsolete and are no longer supported. There is no replacement.



ï Different Return Values A number of new functions have different return values. They are:

assert (see section 12.9.1)

assertstring (see section 12.9.5)

batch (see section 13.1.8)

bload (see section 13.1.3)

bsave (see section 13.1.4)

classslots (see section

classsubclasses (see section

classsuperclasses (see section

dribbleoff (see section 13.2.2)

dribbleon (see section 13.2.1)

duplicate (see section 12.9.4)

getdefmessagehandlerlist (see section

load (see section 13.1.1)

loadfacts (see section 13.4.2)

modify (see section 12.9.3)

save (see section 13.1.2)

savefacts (see section 13.4.3)

slotfacets (see section

slotsources (see section

ï Different Argument Types A number of functions now accept a different number of arguments or different argument types. They are:

agenda (see section 13.7.1)

bind (see section 12.6.1)

delete$ (see section 12.2.5)

dependencies (see section 13.6.11)

dependents (see section 13.6.12)

facts (see section 13.4.1)

instances (see section

listdeffacts (see section 13.5.2)

listdefmessagehandlers (see section

listdefrules (see section 13.6.2)

listdeftemplates (see section 13.3.2)

makeinstance (see section 9.6.1)

refreshagenda (see section 13.7.11)

retract (see section 12.9.2)

showbreaks (see section 13.6.7)

slotexistp (see section

slotinitablep (see section

slotwritablep (see section

unmakeinstance (see section

ï Different Function and Command Behavior - A number of functions and commands now behave differently. They are:

break (see section 12.6.8)

describeclass (see section

directslotinsert$ (see section

format (see section, the % r format flag)

insert$ (see section 12.2.10)

listdefglobals (see section 13.8.2)

loadinstances (see section

slotinsert$ (see section

return (see section 12.6.7)

savefacts (see section 13.4.3)

saveinstances (see section

strassert (see section 12.9.5)

ï Different Output - A number of functions have different output.

describeclass (see section

slotfacets (see section

ï New logical name - all warning messages are sent to the logical name wwarning (see section 12.4.1).

next up previous