[racket] introspecting names and versions of all planet packages used by a program

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Fri Dec 14 08:53:04 EST 2012

At Thu, 13 Dec 2012 23:52:03 -0500, Neil Van Dyke wrote:
> Can a program running in Racket VM introspect on itself to determine the 
> names and versions of PLaneT packages that the program uses?
> 
> I tried poking around with environment introspection, and trying to 
> follow module use graph that way, but no luck so far.  Maybe this is 
> something that modules rightfully hide?

You should be able traverse the import hierarchy using
`module->imports', perhaps starting with an enclosing module's name as
obtained by

 (variable-reference->module-path-index (#%variable-reference))


> The reason I want this is for the About box of an app: 
> "http://i.imgur.com/TofUX.png".  I'd like to acknowledge the PLaneT 
> packages the app uses, and indicate the version numbers for 
> support/debugging purposes.  I'd like to do this programmatically.
> 
> If I can't do this introspection, then I have a bunch of alternatives in 
> mind that might work, but they're all messy and/or a chunk of work.
> 
> Neil V.
> 
> ____________________
>   Racket Users list:
>   http://lists.racket-lang.org/users

Posted on the users mailing list.