Am Mi., 2. Nov. 2022 um 16:07 Uhr schrieb Marc Nieper-Wißkirchen <marc.nie...@gmail.com>: > > Both the R6RS and the R7RS define-record-type syntaxes have one > limitation in common: The record name (useful for inspection or > debugging) is always the symbolic name of the identifier the <record > name> is bound to. > > This is problematic if the identifier should be bound to something > else without renaming the record name as in the following example: > > (define-record-type thunk > (fields proc) > (protocol > (lambda (p) > (lambda (proc) (assert (procedure? proc)) (p proc))))) > > (define-syntax thunk > (syntax-rules () > [(_ body ...) (make-thunk (lambda () body ...)])) > > Unless one has local modules allowing local renaming exports, the only > way out is to use the renaming facility of the library system. > > Thus I propose the addition of a > > (name <symbol>) > > clause (for the R6RS syntax and the proposed extension of the R7RS) to > specify the record name explicitly. The above record-type definition > can then be corrected: > > (define-record-type (<thunk> make-thunk thunk?) > (name thunk) > (fields proc) > ...) > > Alternatively, we could extend the <name spec> (see the R6RS document) > so that it allows to separate name and bound identifier: > > (define-record-type (thunk <thunk>) > (fields proc) > ....)
I decided on the second option. It is now in the spec and implemented in my personal repo. > > Marc