| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (11 out of 17)

Configuring Properties of Items

You can declare that an item has one or more properties, using the statement.

Specifying the Scope of the Declared Properties

You specify declare configuration statements that have different scopes, as shown in these examples:

	{ Scope: Follow the KB's workspace hierarchy or class hierarchy ... } 
declare properties as follows :
optimizable ;
	{ Scope: Only the configured item is affected by the configuration. } 
declare properties of this item as follows :
independent-for-all-compilations ;
	{ Scope: Within the KB's workspace hierarchy or class hierarchy, any item 
of the specified class(es) are to be affected by the configuration. }
declare properties of any tracked-vehicle as follows :
stable-for-dependent-compilations

Specifying Exceptions to the Declared Properties

To specify a statement that represents an exception to a declare statement found in a configuration placed on an item higher in the hierarchy, begin the statement with the phrase:

Examples:

Optimizing the Compilation of an Item

G2 performs certain global optimizations when compiling rules, procedures, and formulas. The optimizations are global in that G2 examines the entire text of the rule, procedure, or formula before compiling any part of it. By default, all items in the current KB are configured as:

You can configure a set of items so that G2's default optimization is disabled.

To disable optimization:

Because only items of G2 system-defined classes can be compiled with optimization, enter these statements in the Item-configuration attribute of those items themselves.

You might not want certain items to be compiled with optimization, for these reasons:

Declaring a Procedure to be Inlined

An inlined procedure is one whose compiled code is embedded in any compiled code that calls the procedure. Inlining a procedure improves performance by eliminating the need to execute a call when the procedure is invoked: control instead passes directly to the embedded code for the procedure. The trade-off is increased compiled code size due to redundant inlined copies of the procedure.

When you inline a procedure, you must also use the configuration clause: stable-for-dependent-compilation.

By default, all items in the current KB are configured as:

To declare that a procedure can be inlined:

Inlining a procedure is further described in Using Compilation Configurations.

Declaring a Method to be Inlined

An inlined method is identical to an inlined procedure: its compiled code is embedded in any compiled code that calls the method. When you inline a method, you must also include the configuration clauses stable-hierarchy and stable-for-dependent-compilation.

A method of stable-hierarchy guarantees that a more specialized method will not be added below the current method in the method hierarchy. If the method includes return values, the stable-hierarchy declaration additionally guarantees the return value types.

By default, all items in the current KB are configured as:

To declare that a method can be inlined:

Inlining a method is further described in Using Compilation Configurations.

Declaring Items as Stable Hierarchy

Declaring an item as stable-hierarchy indicates that neither the class hierarchy of the item, nor the item itself, will be specialized. If a method is declared with stable-hierarchy, then G2 may be able to compile more efficiently the procedures or methods that call the inlined method.

You can also declare classes as stable-hierarchy, which may let G2 compile any methods of that class more efficiently.

By default, all items in the current KB are configured as:

To declare an item to have a stable hierarchy:


Note: This statement must be used when declaring a method as inlineable.

Using the stable hierarchy configuration is further described in Using Compilation Configurations.

Declaring an Item Independent for All Compilations

Declaring an item as independent-for-all-compilations means that the item's knowledge does not depend on the knowledge in any other item in the KB. This allows G2 to compile that item more efficiently.

By default, all items in the current KB are configured as:

To declare an item independent for all compilations:

This feature is described in detail under Using Compilation Configurations.

Declaring an Item Stable for Dependent Compilations

Declaring an item as stable-for-dependent-compilations means that certain parts of the item's knowledge will not change during the KB's processing. This allows G2 to compile more efficiently other items that depend on that knowledge.

By default, all items in the current KB are configured as:

To declare an item as stable for dependent compilations:

This feature is described in detail in Using Compilation Configurations.

Declaring an Activatable Subworkspace for an Item

Most G2 classes can support an activatable subworkspace. Activatable subworkspaces support the programmatic activation and deactivation. You use the activate and deactivate actions to activate and deactivate an activatable subworkspace. By default, all items in the current KB are configured as:

To declare that an item supports an activatable subworkspace:


Note: If items of the configured definition item's class do not support creating an associated subworkspace, G2 ignores that declare properties as follows: activatable-subworkspace configuration statement.

Declaring Subworkspace Connection Posts for Items

If items of a class can have a subworkspace, and (for a user-defined class) if the Icon-description attribute of the class's definition defines connection stubs, you can configure items of that class so that G2 automatically creates permanent connection-posts on the subworkspaces of items of that class.

Through an item's subworkspace connection-posts, you can connect the item of the configured class to items on the subworkspace. Using subworkspace connection-posts is described in Creating Connection Posts on Subworkspaces Automatically.

By default, this property is configured as:

To declare that an item supports subworkspace connection posts:


Note: If the configured items do not have a subworkspace, G2 ignores the declare properties as follows : subworkspace-connection-posts configuration statement.

Disallowing Manual Connections for an Item

For any subclass that is defined to support connections, you can prohibit KB users from drawing connections interactively to or from items of that class, except where pre-existing stubs exist.

By default, this property is configured as:

To declare that an item disallows manual connections:


Note: If items of the configured class do not support manual connections, G2 ignores that declare properties as follows : manual-connections configuration statement.

| Prev | Next | Start of Chapter | End of Chapter | Contents | Glossary | Index | Comments | (11 out of 17)

Copyright © 1997 Gensym Corporation, Inc.