This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
Re: new Scheme()
- From: Per Bothner <per at bothner dot com>
- To: Dean Ferreyra <dferreyra at igc dot org>
- Cc: kawa at sources dot redhat dot com
- Date: Thu, 31 Mar 2005 19:10:25 -0800
- Subject: Re: new Scheme()
- References: <424CB871.6080606@igc.org>
Dean Ferreyra wrote:
> Up until recently this kind of construct worked for us:
public class Env {
public static void main(String[] strings) {
kawa.standard.Scheme.registerEnvironment();
kawa.standard.Scheme scm = new kawa.standard.Scheme();
scm.eval( "(require 'srfi-1)" );
but with the latest CVS pull I get a null pointer exception on the
eval(). Adding a call to this:
scm.setEnvironment(scm.getNewEnvironment());
before the eval() seems to be the fix.
Is this right?
No, I don't think so. Creating a "new Scheme" is questionable;
the changes I've been making are towards making langauges be
"singleton classes" initialized at class initialization time.
Instead, try:
kawa.standard.Scheme scm = kawa.standard.Scheme.getInstance();
... scm.getNewEnvironment() ...
This works, for now:
... scm.getEnvironment() ...
However, I'm not sure it will do so: I think we want to move to a model
where the current "user environment" is language-independent. That
implies that each language has an environment of predefined bindings,
but the user environment is thread-specific, not language-specific.
--
--Per Bothner
per@bothner.com http://per.bothner.com/