Topic: APLX Help : Help on APL language : System Functions & Variables : ⎕EX Expunge
[ Previous | Next | Contents | Index | APL Home ]

www.microapl.co.uk

⎕EX Expunge


The monadic system function ⎕EX causes named objects to be erased. See also )ERASE.

The right argument is a character vector (for a single name) or matrix of names. Expunge returns a vector of numbers in which 1 indicates successful erasure, 0 non-erasure:

      )VARS
DATA RESULT
      )FNS
AVERAGE MEAN    SD
      ⎕EX ⎕BOX 'MEAN STANDARD DATA'
1 0 1
      )VARS
RESULT
      )FNS
AVERAGE SD

Local objects are expunged if both local and global objects of the same name exist. This contrasts with )ERASE which erases the global version.

⎕EX can 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:

      ⎕EX 'COLOR_POINT'
1
      ⎕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:

      ⎕EX 'POINT'
1
      PT.⎕CLASSNAME
NULL
      ⎕CLASS POINT3D
{POINT3D}

Topic: APLX Help : Help on APL language : System Functions & Variables : ⎕EX Expunge
[ Previous | Next | Contents | Index | APL Home ]