This is the mail archive of the guile@cygnus.com mailing list for the guile project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Jost Boekemeier <jostobfe@linux.zrz.TU-Berlin.DE> writes:
> > In Scheme, you can't change the environment of a closure, so "x" and
>
> (define cl (let ((x 1) (y 2)) (lambda () (display HUGO))))
> (procedure-environment cl) -> (((y x) 2 1) #<procedure (symbol define?)>)
>
> Is it save so change (extend) that list?
No. It will conflict with the memoization that the Guile evaluator
performs.
Look at this example:
(define HUGO 18)
(define cl (let ((x 1) (y 2)) (lambda () (display HUGO))))
(cl) -> 18
(set-car! (procedure-environment cl) '((y x HUGO) 2 1 9))
(cl) -> 18
Once cl has been executed it has memoized where the bindings are for
its variables. The use of HUGO has been connected to the global
define, once and for all.