Previous Contents Next
6.9 Classes

Classes are defined using a small language, similar to the module language.

6.9.1 Class types

Class types are the class-level equivalent of type expressions: they specify the general shape and type properties of classes.


class-type ::=  
  | class-body-type
  | [[?]labeltypexpr ->  class-type
class-body-type ::= object [( typexpr )]  {class-field-spec} end
  | class-path
  | [ typexpr  {, typexpr} ]  class-path
class-field-spec ::= inherit class-type
  | val [mutable] inst-var-name :  typexpr
  | method [private] method-name