Previous: , Up: stdlib records   [Index]


5.6.5 Inspection

The (rnrs records inspection (6)) library provides procedures for inspecting records and their record–type descriptors. These procedures are designed to allow the writing of portable printers and inspectors.

On the one hand, record? and record-rtd treat records of opaque record types as if they were not records. On the other hand, the inspection procedures that operate on record–type descriptors themselves are not affected by opacity. In other words, opacity controls whether a program can obtain an RTD from a record. If the program has access to the original RTD via make-record-type-descriptor or record-type-descriptor, it can still make use of the inspection procedures.

Procedure: record? obj

Return #t if obj is a record, and its record type is not opaque, and return #f otherwise.

Procedure: record-rtd record

Return the RTD representing the type of record if the type is not opaque. The RTD of the most precise type is returned; that is, the type t such that record is of type t but not of any type that extends t. If the type is opaque, an exception is raised with condition type &assertion.

Procedure: record-type-name rtd

Return a symbol representing the name of the record–type descriptor rtd.

Procedure: record-type-parent rtd

Return the parent of the record–type descriptor rtd, or #f if it has none.

Procedure: record-type-uid rtd

Return the UID of the record–type descriptor RTD, or #f if it has none. (An implementation may assign a generated UID to a record type even if the type is generative, so the return of a UID does not necessarily imply that the type is nongenerative.)

Procedure: record-type-generative? rtd

Return #t if rtd is generative, and #f if not.

Procedure: record-type-sealed? rtd

Return #t if the record-type descriptor is sealed, and #f if not.

Procedure: record-type-opaque? rtd

Return #t if the the record-type descriptor is opaque, and #f if not.

Procedure: record-type-field-names rtd

Return a vector of symbols naming the fields of the type represented by rtd (not including the fields of parent types) where the fields are ordered as described under make-record-type-descriptor. The returned vector may be immutable. If the returned vector is modified, the effect on rtd is unspecified.

Procedure: record-field-mutable? rtd k

Returns #t if the field specified by k of the type represented by rtd is mutable, and #f if not. k is as in record-accessor.


Previous: , Up: stdlib records   [Index]