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

Distinct fields

The issues section states:

"Macros that expand into the implicit-naming layer might have unexpected behavior, as field names that are distinct as identifiers may not be distinct as symbols, which is how they're used."

Is the concept of distinctness defined with respect to symbolic equivalence?

It is not obvious to me that this should be the case.
In the context of syntax-case, my first thought was that perhaps
free-identifier=? might be a more appropriate predicate for
distinctness, but then the following occurred to me:

(define-syntax foo
  (syntax-rules ()
    ((_ f)
     (define-record-type p
       (fields (mutable x)       ; - would make a secret p-x
               (mutable f))))))  ; - would make a toplevel p-x
                                 ;   when called as below

(foo x)

In implementations of syntax-case that treat defines on
macro-generated identifiers as establishing "secret" bindings
(such as Chez and PLT), the p-x bindings for the two fields would
be distinct, and not interfere, even though they are
free-identifier=?  So the example would probably work.