Gauche
Gauche copied to clipboard
Renamed field names in record type defintions
Gauche does not accept record names that arise through hygienic renaming:
(import (scheme base))
(define-syntax foo
(syntax-rules ()
((foo k) (k field))))
(define-syntax bar
(syntax-rules ()
((bar name)
(define-record-type <rtd>
(make-record name)
record?
(name record-name record-set-name!)))))
(foo bar)
This program gives the error:
*** ERROR: rtd-constructor: field-specs contains unrecognized field name: #<identifier r7rs.user#field.de1e36c0>
While loading "./g.scm" at line 15
Stack Trace:
0 (rtd-constructor #:
.152 #(field)) [unknown location]
PS: It seems that the field names have to be converted from identifiers to symbols, for example here: https://github.com/shirok/Gauche/blob/1a0933e094ae5f1a530a36b3c836afdb822c8647/libsrc/gauche/record.scm#L476
might be related to #532
I have tested with Gauche 0.9.6 that comes with Ubuntu 19.10.
On master, it seems to work
gosh[r7rs.user]$ (foo bar)
#:record-set-name!.617
Yes I think this particular example runs on 0.9.9. The other macro-defining-macro issue discussed in #532 is in unreleased master.