[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: updated version of SRFI 9



Richard Kelsey writes:
>
>When are two define-record-type forms the same?  When are you guarenteed
>to get distinct record types?


Two record types are guaranteed to be distinct if the corresponding
<type name>s are different. If more than one define-record-type
forms use the same <type name>s, the behavior of such a program
is unspecified.

I believe this guarantee is enough for the majority of programs.

>The two situations are quite different.  Internal definitions are
>quite likely to be executed multiple times, under well-defined
>circumstances.  The only way I know of executing a top-level
>definition multiple times is to capture a continuation at top
>level, a somewhat questionable practice.  Because I can write down
>the generative semantics (`every execution of a define-record-type
>gives a new record type') and I cannot write down the non-generative
>semantics (with the possible exception of captured top-level
>continuations), I chose the former.


Yes, the situations are different, but, in my opinion, both are far
from consensus. Top-level definitions can be executed multiple
times when they are duplicated in the program's code due to
various forms of syntax processing (configuration languages,
LOAD, INCLUDE etc.). As for semantics, I am not asking for
non-generative semanics; I would be satisfied with the
generative semantics you have in mind, altered by a
single occur check for <type name> with consequent
part marked as [implementation-dependent] (or
application of the 'wrong' function if you like).

Historical note: Common Lisp's DEFSTRUCT designers
faced the same problem and decided to left the behavior
unspecified. Some details can be found in CLtL2 p.473
and X3J13 DEFSTRUCT-REDEFINITION:ERROR vote:

http://www.harlequin.com/education/books/HyperSpec/Issues/iss118-writeup.htm
l

Sergei