chickadee » typed-records » define-record

(define-record NAME SLOT ...)syntax

Equivalent to define-record where SLOT slot may optionally be of the form



 ((setter SLOTNAME) : TYPE)

define-record adds the following type-declarations:

(: make-NAME (TYPE1 ... -> (struct NAME)))
(: NAME? (* -> boolean : (struct NAME)))
(: NAME-SLOTNAME ((struct NAME) -> TYPE))
(: NAME-SLOTNAME-set! ((struct NAME) TYPE -> undefined))

Additionally, specializations are enabled that rewrite slot-accessors to very efficient code, if the compiler can prove that the arguments are of the correct type.