If a class A declares variables or parameters of another class B (we then say "A uses B"), and B is not one of the predefined classes, then A must declare the use of B.
BNF:
class-decl ::= class identifier [ "<" generics-list ">"] is
class-definition
class-definition ::= [ identifier ] general-class-decl
| ...
general-class-decl ::= class-comment
uses [ ident-list ]
...
end class
The following example shows a class Rectangle that uses two classes Point and Colour.
class Rectangle is
== ... uses Point, Colour
... end class
The effect of the uses clause is that the classes Point and Colour are known inside the class definition of Rectangle and can then be used as types for variables, parameters and return values. The classes Point and Colour must exist in the current project.
Uses clauses are inherited. If a superclass lists a class in its uses clause, the subclass does not need to (and indeed must not) repeat the same class in its uses clause. A superclass itself is automatically known to the subclass - it does not need to be listed as a used class. For more details about inheritance see section 16.
The uses keyword itself is not optional. If a class does not use other classes the uses list is empty, but the keyword must appear in the source.
The predefined classes (Integer, Real, Boolean, String, Array) do not need to be listed in the uses clause. They are automatically known in every class without being explicitly mentioned as being used. This is, in fact, the meaning of the term predefined - those classes are always considered used by every class.