Hi Andy,
 Well, sure, I'd settle for the beginning of the procedure body, if
that were possible.

 After all, the reason I was interested in the first place was that
I'm trying to implement call graph analysis for statprof -- with
output in callgrind format, which happens to require position
information.  For native code, callgrind outputs the destinations of
function calls as being the first line of the function body, so that'd
be fine.

 In terms of a patch, I feel like this wouldn't be so hard if we
could clear the memoization hurdle -- my (naive) understanding of
source-properties is that it's just a hashq-ref, so we could work
around the lambda decl problem by making it a hashx-ref that ignores
that stuff during the hash.


On 1/25/07, Andy Wingo <[EMAIL PROTECTED]> wrote:
Hi Julian,

On Wed, 2007-01-24 at 14:21 -0500, Julian Graham wrote:
> Is
> there some other way I can, for example, find out the line number on
> which a procedure was defined?

I was wondering this myself about a week ago! A couple of hours of
poking through eval.c and debug.c didn't get me anywhere though.

Procedure-source returns the source via unmemoizing guile's memoized
representation, which is always a new tree. So the new tree is not
associated with the original source properties. Furthermore the first
two elements (lambda and the formals list) are reconstructed, they are
not kept from the original source. The best you could do with
source-properties would be the line of the first expression in the body.

I would really like this as well. It would allow automatically-generated
module docs to define procedures in the order that they appear in a
module. Probably needs to be added to procedure-properties rather than
source-properties, though.

Here's hoping someone has a clever patch stashed somewhere :)


_______________________________________________
Guile-user mailing list
Guile-user@gnu.org
http://lists.gnu.org/mailman/listinfo/guile-user

Reply via email to