14.8 Classes as Records

14.8 Classes as Records

We allow the definition of Structures with Inheritance (or classes as records) by extending the existing Record macro (see section 2.1). Its new syntax is:

Record ident [ params ] : sort := ident0 {
    
ident1 [:|:>] term1 ;
...
identn [:|:>] termn }.
The identifier ident is the name of the defined record and sort is its type. The identifier ident0 is the name of its constructor. The identifiers ident1, .., identn are the names of its fields and term1, .., termn their respective types. The alternative [:|:>] is ``:'' or ``:>''. If identi:>termi, then identi is automatically declared as coercion from ident to the class of termi. Remark that identi always verifies the uniform inheritance condition. The keyword Structure is a synonym of Record.



Retrieved by Memoweb from http://pauillac.inria.fr/coq/doc/node.3.3.7.html at 8/10/98