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

delete

You can delete transient or permanent items.

To delete a transient or a permanent item:

You cannot delete a permanent item without first making it transient, unless you use the without permanence checks clause.

Deleting Items Without First Making Them Transient

To delete permanent items without permanent checks, optionally removing connection stubs:

Using the delete action in this way lets you delete permanent items programmatically, completely ignoring all transient restrictions. Deleting items by using the without permanence checks is the programmatic equivalent of the interactive delete menu choice.


Note: Using the delete action omitting the without permanence checks statement requires that items be made transient prior to deletion. For a discussion about making items transient, see Making Permanent Items Transient.

When the delete action executes, any rule that is waiting for a value and that refers to a deleted item (or to one of its attributes, its subworkspace, or to any item on its subworkspace) is cancelled. If a delete action is part of a rule, the rule is not cancelled, but any parallel or subsequent sequential action in the rule that refers to the deleted item causes G2 to signal an error.

A procedure that referenced the item before it was deleted continues to execute, but if it references the deleted item, G2 signals an error.

Removing Stubs While Deleting an Item

You can remove connection stubs from a remaining item when deleting an item to which another is connected.

To remove stubs when deleting an item connected to another:

The first diagram in this example shows two connected objects C1 and C2, and the result of deleting C1 with the delete action using the removing connection stubs expression:


Deleting Connections

To delete a connection:

You can delete a transient connection or a permanent one by using the without permanence checks grammar. Deleting a connection does not delete the stubs, unless you use the removing connection stubs statement with the delete action, as in the next example.


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

Copyright © 1997 Gensym Corporation, Inc.