Would it be helpful to add a define-record-type-checked macro? Since
define-record-type can generate many procedures, it could be tedious to
wrap each of them with checked versions.
Here is a (mostly) portable R7RS implementation built on
define-record-type:
```
(cond-expand
(gauche) ; Does not work in Gauche due to inlining.
(else
(define-syntax set!-record-field-checked
(syntax-rules ()
((_ predicate check)
(begin))
((_ predicate check mutator)
(let ((x mutator))
(set! mutator (lambda-checked ((obj predicate) (val check))
(x obj val)))))))
(define-syntax accessor-checked
(syntax-rules ()
((_ predicate accessor)
(let ((x accessor))
(set! accessor (lambda-checked ((obj predicate))
(x obj)))))))
(define-syntax define-record-type-checked
(syntax-rules ()
((_ type
(constructor (tag check) ...)
predicate
(field-tag accessor . more) ...)
(begin (define-record-type type
(new-constructor tag ...)
predicate
(field-tag accessor . more) ...)
(define-checked (constructor (tag check) ...)
(new-constructor tag ...))
(accessor-checked predicate accessor) ...
(set!-record-field-checked predicate check . more)
...))))))
```