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

William D Clinger will at ccs.neu.edu
Thu Mar 9 12:59:44 EST 2006


Thanks for explaining this, Kent.

Before people get too annoyed with me for asking so many
language-lawyer questions, let me explain my motivation.
We are designing and writing a specification.  One way to
test a specification is to imagine what the most minimal
or weirdest implementations of it might look like.  It's
a kind of sanity check.

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))))

Note that this macro expansion assumes the program never
assigns a different value to foo.

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

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

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?

(By the way, you can assume I know how to rewrite the macro
expansion so it wouldn't be affected by an assignment to
foo.  I'd just like to know whether SRFI 76 says enough to
settle whether the general approach shown above is legal,
or would be legal if it weren't so vulnerable.)

Will



More information about the R6RS mailing list