Editing Classes
Between the :Class
and :EndClass
statements, you may insert any number of function bodies, Property definitions, and other elements. When you fix the Class Script from the editor, these items will be fixed inside the Class namespace.
Note that the contents of the Class Script defines the Class in its entirety. You may not add or alter functions by editing them independently and you may not add variables by assignment or remove objects with ⎕EX
.
When you re-fix a Class Script using the Editor or with ⎕FIX
, the original Class is discarded and the new definition, as specified by the Script, replaces the old one in its entirety.
Note
Associated with a Class (or an instance of a class) there is a completely separate namespace which surrounds the class and can contain functions, variables and so forth that are created by actions external to the class.
For example, if X
is not a public member of the class MyClass
, then the following expression will insert a variable X
into the namespace which surrounds the class:
MyClass.X←99
The namespace is analogous to the namespace associated with a GUI object and will be re-initialised (emptied) whenever the Class is re-fixed. Objects in this parallel namespace are not visible from inside the Class or an Instance of the Class.
For further information, see Changing Scripted Objects Dynamically.