unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* procedure-source inconsistencies
@ 2008-07-22 16:40 Gregory Marton
  2008-08-08 21:25 ` Neil Jerram
  0 siblings, 1 reply; 3+ messages in thread
From: Gregory Marton @ 2008-07-22 16:40 UTC (permalink / raw)
  To: bug-guile; +Cc: Linda Brown Westrick

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~~~~^^^^~~~~~--~~~~~~~~~~~~~~~++~~~~~~~





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-08-08 21:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-07-22 16:40 procedure-source inconsistencies Gregory Marton
2008-08-08 21:25 ` Neil Jerram
2008-08-08 21:36   ` Gregory Marton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).