| Prev
| Next
| Start of Chapter
| End of Chapter
| Contents
| Glossary
| Index
| Comments |
(15 out of 19)
Customizing Definition Classes
Definitions are the means by which the G2 class hierarchy is extended. This extensibility extends to the definition classes themselves. You can:
Make
CLASS-DEFINITION
(or any specialized definition) the direct superior of a
CLASS-DEFINITION
.
Give the customized definition user-defined attributes.
An instance of the customized definition is itself a definition, so it can be used to define a new class. Any instance of that class can then reference that definition to obtain the value of the definition's user-defined attribute(s) using the grammar:
the
attribute
of the definition named by the class of
item
This capability is useful when an attribute relevant to a class has the same value for all instances of a class at any given time. Storing the attribute in the definition:
Saves space by not storing a redundant copy of the attribute and its value in each instance.
Saves time when the value changes by avoiding the need to update every instance to reflect the new value.
Is more modular, and provides faster access, than using a freestanding variable or parameter to factor out the attribute.
| Prev
| Next
| Start of Chapter
| End of Chapter
| Contents
| Glossary
| Index
| Comments |
(15 out of 19)
Copyright © 1997 Gensym Corporation, Inc.