guile-user
[Top][All Lists]
Advanced

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

RE: equality of syntax objects


From: Maxime Devos
Subject: RE: equality of syntax objects
Date: Thu, 23 May 2024 00:12:02 +0200

>asked more simply:

>how to know ,for two syntax objects now different but that represents two
different procedures created with the same name at two different moment,how
to know that the names are still the same?

>i see two solutions:
-parse the representation string to know for example expt that expt is in
both string:
"#<syntax:unknown file:2:7 expt>"
"#<syntax:operation-redux.scm:88:12 expt>"
not really pretty but will work.I test it in Racket and kawa too...

It appears you want to know equality as _symbols_, instead of equality of 
_identifiers_.

>    (and (identifier? obj1) ;(syntax? obj1)
>             (identifier? obj2) ;(syntax? obj2)
>             (free-identifier=? obj1 obj2)))

So, instead of checking identifiers with free-identifier=?, instead try 
‘syntax->datum’ to extract the name (with lexical information removed) + ‘eq?’ 
(to compare two symbols).

Best regards,
Maxime Devos


reply via email to

[Prev in Thread] Current Thread [Next in Thread]