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]

Problem implementing environments




Hi,

I need some suggestions on how to implement the function: 
`env-fold ENV PROC INIT' which should iterate over all local but 
not inherited bindings.

The Problem is that the current evaluator uses tail recursion and
expands an environment "in place".  For example: 


(define (c) (let ((a 1)) ((let ((x 2)) (display x)))))

expands to the environment:

scm_lookupcar (vloc=1075242544, genv=1075243352, module=1075056856, modify=0, 
    found_in_module=0xbffff718) at eval.c:261

(Forget about the module parameter, modules will be special kinds of
environments in the future..)

(gdb) 
(gdb) dp vloc
0x80b2f18 "(display x)"
(gdb) dp genv
0x80b2f18 "((x . 2) (a . 1) (()))"
(gdb)       ^^^^^^^^^^^^^^^



At the moment I think it isn't possible to implement MIT scheme environments
without slowing down the evaluator.  :|

Any hints/suggestions from the experts?


Jost