Re: [Scheme-reports] define-record-type queries
Andre van Tonder 05 May 2011 15:52 UTC
On Thu, 5 May 2011, Aaron W. Hsu wrote:
> On Thu, 05 May 2011 10:23:30 -0400, Andre van Tonder <andre@het.brown.edu>
> wrote:
>
>> The same goes for the field names. Are they compared as identifiers or
>> as
>> symbols? Again, macro-generated code might generate two field names that
>> are the same symbol but different identifiers. Would this be a problem?
>
> This shouldn't come up, because you are required to explicitly give the
> accessor name in a record definition, so every binding introduced is
> exactly specified by the input. I do not see an error situation if to
> accessors of the same name are supplied for different fields, though, and
> this should be fixed. I will see if we already have a ticket on this.
It may come up because the constructor takes field names. Here is an example:
(define-syntax foo
(syntax-rules ()
((_ name name? x get-x)
(define-record-type name (make-foo y x) name? (x get-x) (y get-y))))
(foo y y? y get-y)
This generates a record definition with two fields symbolically given by y, but
the two ys are not the same identifier (the y introduced by the macro has a
different color or mark and is therefore different from the y passed to the
macro).
If an implementation compares field names using eqv? when coming up with the
constructor definition, the above will fail. If it compares them as identifiers
(using bound-identifier=?) the constructor definition will succeed fine.
_______________________________________________
Scheme-reports mailing list
Scheme-reports@scheme-reports.org
http://lists.scheme-reports.org/cgi-bin/mailman/listinfo/scheme-reports