<h1>Record Properties</h1>

Record properties are a way to attach arbitrary information to record
types and/or instances. The interface to record properties has three
parts:

  *  The module <tt>srfi-99-records-inspection</tt> exports the
     procedure <tt>make-rtp</tt> that creates new record property
     accessors.
  *  A property is attached to a record type using the special keyword
     argument <tt>#:property</tt> of <tt>make-rtd</tt>, followed by a
     property accessor generated by <tt>make-rtp</tt> and a property
     value.
  *  A property is accessed by calling the property accessor generated
     using <tt>make-rtp</tt> on a record instance and/or a record type
     descriptor.

<h2>Creating Record Property Accessors</h2>

A record property accessor is created with a call to <tt>make-rtp</tt>
or using the shorthand syntax <tt>define-record-property</tt>:

<verbatim>
  (make-rtp [default any? #f]) => procedure?

  (define-record-property name [default any? #f])
</verbatim>

The result is a procedure that can be used to access the new record
property with the given default value.

<h2>Accessing Record Properties</h2>

A record property accessor accepts two arguments, some value and a
record type descriptor:

<verbatim>
  (rtp [v any?] [rtd rtd? (record-rtd v)]) => any?
</verbatim>

The record type descriptor can be omitted if the value passed as the
first argument is an instance of a transparent record.

The accessor looks up the property value for the given record type (or
any of its parents) when it is called. If it doesn't find a value it
resorts to the default specified when the record property was created.
The value is then applied to <tt>v</tt> to obtain the result of the
accessor call.

Default property values passed to <tt>make-rtp</tt> which are not
procedures are implicitly converted to procedures constantly returning
the default value.

Property values passed to <tt>make-rtd</tt> which are not procedures
or symbols are implicitly converted to constant generators like
property default values. Symbols are implicitly converted to accessor
procedures for the field of the same name in the new record type to
which the property is attached.

<h2>Listing Record Properties</h2>

The record properties attached directly to a type descriptor can be retrieved using

<verbatim>
  (rtd-properties [rtd rtd?]) => (listof procedure?)
</verbatim>

and all record properties attached to a type descriptor or its parents can be retrieved using

<verbatim>
  (rtd-all-properties [rtd rtd?]) => (listof procedure?)
</verbatim>