This is the mail archive of the kawa@sources.redhat.com mailing list for the Kawa project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: extend-top-level-environment


Chris Dean wrote:

I need a way to create multiple environments so that I can eval
expressions in different and separate environments.  How about:

  (define (extend-top-level-environment (env :: <gnu.mapping.Environment>))
    (make <gnu.mapping.Environment> env))

  (define (make-root-top-level-environment)
    (extend-top-level-environment (scheme-report-environment 5)))

Would this code function properly in Kawa?

That would probably more-or-less work, but there are some corner cases. An issue is what is what does it mean to have "multiple environments"? Which symbols are shared and which are not? How does this interact with compilation: In which environment(s) is a compiled module?


A complication is that some languages (XQuery and Common Lisp) have multiple "packages" or "namespaces". How should "multiple environments"
combine with "multiple packages"? In the current Kawa I identify a Common List package or XQuery namespace with a gnu.mapping.Environment.


One alternative to multiple environments is to use fluid bindings. This allows each thread to have a separate "global" value for for each symbol.

I don't know the answer is to these questions. Perhaps if you describe how you intend to use the multiple environments?
--
--Per Bothner
per@bothner.com http://per.bothner.com/




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]