At Thu, 25 Jul 2019 18:55:18 -0700 (PDT), Yongming Shen wrote:
> Based on my understanding, (bound-identifier=? id-a id-b) only returns true 
> if id-a would bind id-b AND id-b would bind id-a. Also based on my 
> understanding, id-a will bind id-b doesn't imply that id-b will bind id-a. 
> So, if I only want to check whether id-a will bind id-b, which function 
> should I use?

There's not a predicate like that right now (I guess only because we
haven't needed it).

Here's one way to implement the predicate:

 (define (would-bind? a b)
   (subset? (list->set (hash-ref (syntax-debug-info a) 'context))
            (list->set (hash-ref (syntax-debug-info b) 'context))))

A built-in operation would work the same way, except that it could be
more efficient by not serializing scopes to a list in debugging
information and then converting the list back to a set.


Matthew

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/5d3adf03.1c69fb81.9c738.1672SMTPIN_ADDED_MISSING%40gmr-mx.google.com.

Reply via email to