[racket] is there any way to check whether two syntax objects have the same ... ?

From: Carl Eastlund (carl.eastlund at gmail.com)
Date: Sun Aug 17 14:29:18 EDT 2014

Comparing lexical context is a very involved process.  Remember that every
syntax object potentially carries context for an unbounded number of symbol
names at an unbounded number of phases, since context information can be
transferred freely.  Comparing all of them for equivalence would be quite
expensive.  You probably want to either decide what subset of that context
is relevant to you, or reformulate your solution in a way that does not
involve comparing syntax at all.  It's a problematic technique to employ,
to say the very least.
On Aug 17, 2014 12:02 PM, "Alexander D. Knauth" <alexander at knauth.org>
wrote:

> But those only work on identifiers, right?
>
> But would something like this work?
>
> (define (lexical-context=? s1 s2)
>   (bound-identifier=? (datum->syntax s1 ‘x) (datum->syntax s2 ‘x)))
>
> Or would that miss something?
>
>
>
> On Aug 17, 2014, at 1:31 PM, Roman Klochkov <kalimehtar at mail.ru> wrote:
>
> Maybe something of
>
> http://docs.racket-lang.org/reference/stxcmp.html
> <http://docs.racket-lang.org/reference/stxcmp.html?q=free-identifier>
>
> ?
>
>
> Sat, 16 Aug 2014 23:32:10 -0400 от "Alexander D. Knauth" <
> alexander at knauth.org>:
>
> Is there any way to check whether two syntax objects have the same lexical
> information, syntax-e (recursively), source location, properties, and
> whatever else they have, even if they aren’t eq?
>
> For the syntax-e and source-location this is straightforward, but if
> there’s no accessor for the lexical information then how do I check if the
> lexical information is the same if the syntax objects aren’t eq?
>
> And for the properties, can you only check the properties with keys that
> are interned symbols?
>
>
>
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
>
>
>
> --
> Roman Klochkov
>
>
>
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140817/b0c1eb9c/attachment.html>

Posted on the users mailing list.