[plt-scheme] procedure instrospection

From: Jose A. Ortega Ruiz (jao at gnu.org)
Date: Sat Apr 18 02:14:06 EDT 2009

Hi Ryan,

Ryan Culpepper <ryanc at ccs.neu.edu> writes:


> For the most part, no. That information isn't attached to procedures.
> The easiest question is "What file is a name defined in?"


> Since you can get the module path where a name is defined, you can
> read the module in from the file and try to search it for the
> definition.

i see. that's useful, thanks. i was wondering whether it'd be possible
to somehow hook into the module evaluation process to collect metadata
while the module is read (or evaluated/expanded), specially for the case
of formals names. i'm thinking of something simple, and not necessarily
100% accurate--a hash table maintained separately, say, recording
metadata computed during evaluation.

or, as you suggest, i could also read the module source as data, and
parse it to obtain/cache the information i want (although that sounds a
bit brittle and more inaccurate, since it relies on the program's text
instead of syntax data)... i'm guessing that plt already provides
procedures to help in the task (for instance, ports remembering line and
columns): any advice on what would be the best way to accomplish that?

i'm not sure if i'm making any sense at all, but in case i am, this
could perhaps grow into some sort of introspection extension to plt
proper, and i'd be willing to help with real code. just an idea, in case
you (the plt team) think that improving introspection is a worthy goal.


Posted on the users mailing list.