swirl
Guide to OmniMark 8   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
    Related Concepts  
modifier  

: (field selection operator)

 
 

Syntax

record variable : field name


Purpose

You can use : (colon) to select an individual field of a record:

  declare record metadata-label
     field string author
     field string title
     field string publisher
     field integer year
     field switch in-print initial {true}
  
  process
     local metadata-label doc-info
  
     set doc-info:author to "Mark Baker"
     set doc-info:title to "Internet Programming with OmniMark"
     set doc-info:publisher to "Kluwer Academic Publishers"
     set doc-info:year to 2000
  
     set author-name to doc-info:author
     output doc-info:title

The field selection operator can also be used to select a field from an expression of a record type. The expression must be parenthesized. Thus, the field selection operator can be applied to a function call if that function returns a record type:

  declare record point
   field integer x
   field integer y
  
  declare record pixel
   extends point
   field stream color
  
  define dynamic point function move-point
   value point a
   to value point b
   as
     local point c
     set c:x to b:x
     set c:y to b:y
     return c
  
  define overriding point function move-point
   value pixel a
   to value point b
   as
     local pixel c
     set c:x to b:x
     set c:y to b:y
     return c
  
  process
   local point a variable
   local pixel b
   local point c
  
   set b:x to 5
   set b:y to 78
   set b:color to "red"
  
   set c:x to 87
   set c:y to 56
  
   output "d" % (move-point b to c):x

      Related Concepts
   Records
 
 

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.