|
| Previous: 2.11 Scoping Rules | TOC | Index | Back | Next: 2.12 Type Checking |
At the end of a class context, all names contained in that class context as well as the classname itself will be removed from the global context. However, the class name will be memorized at a different location and may never be reused in the same program. This is a workaround for an ugly problem resulting from an interference with the module system. Imagine the following situation:
CLASS A() ... END A() DO ... END CLASS B(A) ... END
Since the class name of A is removed at the end of A, the name A could be reused to name a procedure. Therefore, the class B would depend upon the procedure A, which would be semantically incorrect. On the other hand, if the name A would persist in order to prohibit its redeclaration, the following code would be correct:
CLASS A() ... END CLASS B() OBJECT XA[A]; END
In this case, class B could instantiate class A without depending on it, which would be semantically incorrect, too, because the module extension requires that B dependends on A in this case. Therefore, the (admittedly brute force) solution of not permitting the reuse of (deleted) class names has been chosen.
| Previous: 2.11 Scoping Rules | TOC | Index | Back | Next: 2.12 Type Checking |