[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Distinct fields
Andre van Tonder <andre@xxxxxxxxxxxxxxxxx> writes:
> 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?
Not so far as I know.
> 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.
That would depend on the way the macro defining the implicit
variant of DEFINE-RECORD-TYPE is written, right? In particular, I
think the ones that I wrote decompose the names into strings and then
back, so I think any distinctness might get lost on the way.
Cheers =8-} Mike
Friede, Völkerverständigung und überhaupt blabla