[R6RS] relationships between uid, <record name>, and rtd

Michael Sperber sperber at informatik.uni-tuebingen.de
Thu Mar 9 13:30:01 EST 2006

William D Clinger <will at ccs.neu.edu> writes:

> My question is whether the following kind of implementation
> would meet the requirements of SRFI 76.
>   (define-record-type
>     (foo make-foo foo?)
>     (fields (immutable x get-x)))
> macro expands (assuming a form of letrec* semantics for
> definitions) into
>   (begin
>     (define foo
>       (make-record-type-descriptor 'foo #f #f #f #f '(immutable x)))
>     (define make-foo
>       (lambda (x) ((record-constructor foo) x)))
>     (define get-x
>       (lambda (rec) ((record-accessor foo 0) rec))))

Well, for just this record type, except for the different usage of
`record-constructor', yes.  (It would get more complicated as you
define subtypes, but I believe it could be done.)

> Are programs forbidden to assign to the record name bound
> by define-record-type ?

Yes, because (as currently described) `foo' may be syntax binding.

> If programs are forbidden to assign to the record name,
> then must/should/may such assignments raise an exception?

No, because (as currently described) `foo' may be a regular value

> If programs are not forbidden to assign to the record name,
> then does/may such an assignment have any effect out of the
> ordinary?
> In particular, does/may it affect the behavior of a use
> of define-record-type that occurs within the scope of the
> record name, uses foo as its parent, and is evaluated
> after the assignment?


Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla

More information about the R6RS mailing list