Next: , Previous: , Up: iklib records defs   [Index]


6.19.1.3 The constructor signature

In a use of the syntax define-record-type, the definition clause:

(constructor-signature ?signature)

allows the specification of a type signature for the record–type constructor. This clause is meant to be used in the context of the typed language.

Some usage examples:

(define-record-type <duo>
  (fields {one <fixnum>}
          {two <string>})
  (constructor-signature
    (lambda (<fixnum> <string>) => (<duo>))))

(define-record-type <alpha>
  (fields {A <fixnum>}
          {B <string>})
  (protocol
    (lambda (make-record)
      (lambda (A)
        (make-record A (number->string A)))))
  (constructor-signature
    (lambda (<fixnum>) => (<alpha>))))

This clause is needed because the protocol clause does not allow the specification of a full type signature for the record–type constructor.

When the clause constructor-signature is not used, the syntax define-record-type just defines a default type signature as follows:

(lambda <list> => (?type-name))