[racket] identifier-binding source-id vs. nominal-source-id

From: Robby Findler (robby at eecs.northwestern.edu)
Date: Tue Jul 22 19:08:32 EDT 2014

On Tue, Jul 22, 2014 at 3:42 PM, Greg Hendershott
<greghendershott at gmail.com> wrote:
> p.s. I guess the tl'dr version of all that would be:
>
> Given an identifier symbol from a source file, is there a reliable way
> to find the name used in its definition?  Even following an
> arbitrarily long series of contract-out and/or rename-out provides?
>
> It doesn't seem that identifier-binding, alone, can do this. Is there
> some other way?
>
> IIUC DrRacket doesn't attempt to do this; if the definition is in
> another file, the command is "Open Defining File" (but it doesn't take
> you to the definition site within the file).  Maybe that's because
> it's not easy to do, or perhaps not feasible generally?

DrRacket will do this, but only if the file is open in another tab and
online check syntax is "warmed up" in that tab. It does it by having
online check syntax track where the definitions are in the other file
by looking at the fully expanded version of the defining file and
getting source locations of definitions.

It seems like it could be possible to cache this information in a file
that's parallel to the .zo file to make this kind of navigation more
reliable.

I also think, fwiw, that jumping to the contract is a Good Thing here
(and then you have to hit the key again on the identifier in
'contract-out' form to jump to the definition of the identifier
without the contract).

Robby

Posted on the users mailing list.