swirl
Guide to OmniMark 8   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
  Related Syntax   Related Concepts  
declaration/definition  

record, declare record

 
 

Syntax

declare record record-type-name
   (extends record-type-name)?
   ((field field declaration)* | elsewhere)


Purpose

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.

    Related Syntax
   elsewhere
   global, local, constant, field
   : (field selection operator)
   export, export as opaque
 
Related Concepts
   Records
   Records, extended
   Records, pre-defining
   Shelves
   Tree data structures
 
 

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ LEGACY LIBRARIES ] [ ERRORS ]

OmniMark 8.2.0 Documentation Generated: March 13, 2008 at 3:33:48 pm
If you have any comments about this section of the documentation, please use this form.

Copyright © Stilo International plc, 1988-2008.