Erases named global variables, functions, operators and classes from the active workspace. The command is followed by the name, or names, of the objects to be erased. If an item cannot be erased, a message to that effect is displayed. Local variables are not erased - use ŚEX if you wish to do this.
)ERASE ‘CC NEMO NOT FOUND: NEMO
If one or more of the names following the )ERASE command is enclosed in parentheses and is the name of a variable which is a simple character scalar, vector or matrix, then the contents of the variable are interpreted as the name or names of items to be erased.
)VARS A B C DATA MAT )ERASE A C )VARS B DATA MAT NAMES„ŚBOX 'B DATA' NAMES B DATA )ERASE (NAMES) (rows of NAMES interpreted as object to erase) )VARS MAT NAMES )ERASE NAMES )VARS MAT DATA„'A_NAME' )VARS DATA MAT )ERASE (DATA) (same error message as direct erase) NOT FOUND: A_NAME
)ERASE can be used to erase a member (a method of property) from a class definition, using dot notation in the form ClassName.MemberName to specify which member should be deleted. The change will immediately be reflected in any existing instances of the class:
PT„ŚNEW COLOR_POINT PT.ŚNL 2 © List properties of object PT COLOR X Y Z )ERASE COLOR_POINT.Z PT.ŚNL 2 © Object PT now has one less property COLOR X Y
)ERASE can also be used to erase a class definition (and all the methods and properties defined in it). Any instances of the class will become instances of the erased class's parent, if there is one, or of the NULL class, if the erased class did not have a parent. Similarly, any classes which inherited from the erased class will be re-parented so that they now inherit from the erased class's parent.
In this example, class POINT3D inherits from COLOR_POINT which in turn inherits from POINT. PT is an instance of COLOR_POINT:
)CLASSES COLOR_POINT POINT POINT3D ŚCLASS POINT3D {POINT3D} {COLOR_POINT} {POINT} PT„ŚNEW COLOR_POINT PT.ŚCLASSNAME COLOR_POINT
If we erase the class COLOR_POINT, its child class POINT3D is re-parented. The instance PT becomes an instance of the original parent:
)ERASE COLOR_POINT ŚCLASS POINT3D {POINT3D} {POINT} PT.ŚCLASSNAME POINT
If we now erase the class POINT, POINT3D will now have no parent, and the instance PT becomes an instance of the NULL class:
)ERASE POINT PT.ŚCLASSNAME NULL ŚCLASS POINT3D {POINT3D}