|
|||||
|
|||||
Related Syntax | Related Concepts | ||||
declaration/definition |
record, declare record |
Syntax
declare record record-type-name (extends record-type-name)? ((field field declaration)* | elsewhere)
You can use declare record
to declare a record type.
Here is how you would declare a record type to hold a simple metadata record for a document:
declare record document-metadata field stream author field stream title field stream publisher field integer year field switch in-print initial {true}
Each field in the record is itself of a particular type and is declared just as a local variable of that type would be declared, substituting the word field
for the word local
. Each field in a record is itself a shelf.
A record declaration by itself simply defines a record type. To create a record you must create a variable of the record type.
A record can be declared as an extension of another record type, using extends
:
declare record book-metadata extends document-metadata field stream isbn-number
An extended record type inherits the fields of its base type.
The keyword elsewhere
can be used record pre-definitionto make the record name and some of the properties available without defining all of the record's properties.
Copyright © Stilo International plc, 1988-2008.