[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Small modification

This page is part of the web mail archives of SRFI 9 from before July 7th, 2015. The new archives for SRFI 9 contain all messages, not just those from before July 7th, 2015.



How about the following modification: 

 <command or definition>           
   -> <record type definition>           ; addition to 8.1.6 in R5RS

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

 <field spec> -> (<field tag> <accessor name>)
              -> (<field tag> <accessor name> <modifier name>)

 <optional field spec> 
	      -> (<field tag> <expression> <accessor name>)
              -> (<field tag> <expression> <accessor name> <modifier name>)

 <field tag> -> <identifier>
 <... name>  -> <identifier>

The value of the expression field in <optional field spec> is the initial
value of the optional field. 

I understand that this rules out references to other fields but that's fine
by me. Someone can now build a more elaborate initialization syntax on top
of this srfi. 

-- Matthias