guile-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Guile top-level functions


From: Neil Jerram
Subject: Re: Guile top-level functions
Date: Mon, 17 Jan 2005 23:15:53 +0000
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7.3) Gecko/20041007 Debian/1.7.3-5

Kevin Ryde wrote:
Neil Jerram <address@hidden> writes:

- procedure-source may return a new unmemoized copy of the procedure's source, not the original source, and without source properties attached


Yep, or does it drops off the lambda and formals from the list, thus
losing the source position info (that being on the start of the list
only)?

        (read-enable 'positions)
        (define (x) (display 'hello))
        (source-properties (procedure-source x))
        => ()

Another use for positions on procedures I mentioned another time was
to show that info in a backtrace.  When you just see "<procedure #f>"
it's a bit of a guessing game to tell where the offending bit actually
came from.

Except that normally the backtrace info already has it right. For example, with this typed into the REPL -

guile> (define (x) (ddd))
guile> (x)

- my soon-to-be-released debugger shows the stack at the error as:

=> st (ddd)
   s  [x]
      [primitive-eval (x)]

The `s' here shows that there are source properties for the frame on that line, calculated as:

(if (frame-procedure? frame)
    (or (frame-source frame)
        (let ((proc (frame-procedure frame)))
          (and proc
               (procedure? proc)
               (procedure-source proc))))
    (frame-source frame))

So it looks like frame-source is getting at the info somehow - we just need to investigate how.

(I'll do that tomorrow evening if no one else beats me to it.)

        Neil




reply via email to

[Prev in Thread] Current Thread [Next in Thread]