bug-guile
[Top][All Lists]
Advanced

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

procedure-source inconsistencies


From: Gregory Marton
Subject: procedure-source inconsistencies
Date: Tue, 22 Jul 2008 12:40:40 -0400 (EDT)

Hi folks,

We're running into an issue where we're trying to associate some information about functions by associating the info with their serialized form, which is in part their procedure-source. Unfortunately, the procedure-source changes when a function is invoked:

(define (equal-source-after-apply? f)
   (if (not (equal? (procedure-source f)
                   (begin (f)
                          (procedure-source f))))
       (procedure-source f)
       #t))

(equal-source-after-apply? (lambda () (let ((x 3)) x)))
;; before: (lambda () (let ((x 3)) x))
;;  after: (lambda () (let* ((x 3)) x))
(equal-source-after-apply? (lambda () '#:g))
;; before: (lambda () (quote #:g))
;;  after: (lambda () (begin #:g))

I can imagine one solution to be remembering the actual source somewhere instead of regenerating it in procedure-source. That would be great.

As a less invasive option, perhaps procedure-source could do whatever it is that invocation does to "simplify" the function before returning the source for the first time?

Thanks,
Grem

--
------ __@   Gregory A. Marton                http://csail.mit.edu/~gremio/
--- _`\<,_                                                                .
-- (*)/ (*)                   There's no place like /home
~~~~~~~~~~~~~~~~-~~~~~~~~_~~~_~~~~~v~~~~^^^^~~~~~--~~~~~~~~~~~~~~~++~~~~~~~





reply via email to

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