[Larceny-users] procedure introspection

Jose A. Ortega Ruiz jao at gnu.org
Fri Mar 13 15:20:35 EDT 2009


William D Clinger <will at ccs.neu.edu> writes:


[...]

> The operations beginning with procedure-arity are
> implemented minimally; the only ones that are likely
> to return useful information (as opposed to #f) are
> procedure-arity and procedure-name, and even the
> procedure-name procedure returns #f more often than
> you'd like.

I've observed that much. The latter is probably not a problem for my
system.

> The procedure-expression procedure will work if you
> incant (include-source-code #t) to change that
> compiler switch, but it exposes some confusing
> renaming of keywords, and that compiler switch is
> automatically turned off when compiling files (to
> keep the compiled files from becoming much larger).

Unless procedure-arity is extended to provide them, i'd be using
procedure-expression to get the arguments' *names*, to display short
help notices in emacs echo area (using eldoc). I guess i can always
recompile things dynamically in the REPL with (include-source-code #t)
to get the procedure's expression, although it's a bit of a waste
because i only need the lambda formals.

Is there a similar facility for macros?

[...]

> It is indeed a simple matter of programming.  The
> current development system is already capable of
> recording source code positions, and the compiled
> code and the compiler's intermediate representations
> already contain documentation slots where that info
> should go.
>

That's very good news! 

> I'll try to get this into the next release (v0.97),
> but if not it should certainly be improved in v0.98.

Excellent. Very much appreciated.

While we're at it, i've got a couple more questions:

- is there (or could there be in future versions) a way to obtain a list
  of callers and callees of a given procedure?
- when hacking in other schemes with a module system (e.g. guile or
  s48), one has the ability of evaluating forms in a module's context
  when in the REPL. R6RS precludes REPLs, so the question is moot there,
  but what about larceny's REPL in ERR5RS mode?

Thanks a lot for your prompt answer and support. I'm hoping to be able
to provide a pleasant little emacs environment for larceny hacking!

Cheers,
jao




More information about the Larceny-users mailing list