Next: , Previous: , Up: srfi err5rs records spec   [Index]


2.32.3.3 Syntactic Layer

The syntactic layer consists of SRFI-9 extended with single inheritance and (optional) implicit naming.

All ERR5RS record–type definitions are generative, but ERR5RS drops the SRFI-9 restriction to top level, mainly because the R6RS allows generative definitions wherever a definition may appear.

The (srfi :99 records syntactic) library exports the define-record-type syntax specified below.

The syntax of an ERR5RS record–type definition is:

<definition>
  -> <record type definition>     ; addition to 7.1.6 in R5RS

<record type definition>
  -> (define-record-type <type spec>
       <constructor spec>
       <predicate spec>
       <field spec> ...)

<type spec>  -> <type name>
             -> (<type name> <parent>)

<constructor spec>
             -> #f
             -> #t
             -> <constructor name>
             -> (<constructor name> <field name> ...)

<predicate spec>
             -> #f
             -> #t
             -> <predicate name>

<field spec> -> <field name>
             -> (<field name>)
             -> (<field name> <accessor name>)
             -> (<field name> <accessor name> <mutator name>)

<parent>           -> <expression>

<type name>        -> <identifier>
<constructor name> -> <identifier>
<predicate name>   -> <identifier>
<accessor name>    -> <identifier>
<mutator name>     -> <identifier>
<field name>       -> <identifier>

The semantics of a record type definition is the same as in SRFI-9: the record type definition macro–expands into a cluster of definitions that:

An ERR5RS record type definition extends SRFI-9 with the following additional options:


Next: , Previous: , Up: srfi err5rs records spec   [Index]