This is the mail archive of the kawa@sourceware.cygnus.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]

problem with environments


Per is out of town, and it looks like our mail server is no longer an open
relay (hallelujah!), so I will open this up to the list for ideas:

The following code works under kawa 1.6.1, but fails under 1.6.64 and 1.6.66

package edu.umich.med.healthmedia.hamster;
import kawa.standard.Scheme;
import gnu.mapping.Environment;
import gnu.mapping.WrongType;
import gnu.mapping.WrongArguments;
import gnu.mapping.UnboundSymbol;
import java.util.Enumeration;

public class SurveyFactoryApp
{
    public static void main(String[] args)  {

    Object result = null;
    Scheme myInterpreter = new Scheme();
    Environment myEnvironment = myInterpreter . getEnvironment ();
    Environment . setCurrent ( myEnvironment );
    myInterpreter . eval (
            "(define (exclude lis exc) "+
                "(if (null? lis) '() "+
                    "(if (not (member (car lis) exc)) "+
                          "(cons (car lis) (exclude (cdr lis) exc)) "+
                          "(exclude (cdr lis) exc))))" );
    }
}

under 1.6.64:

If I set a breakpoint right before executing the myInterpreter.eval, I
notice that myInterpreter . environ refers to an environment with the name
"interaction-environment.1". The previous link goes to an environment with
no name (the name field is null), which links to r5rs, which links to r4rs,
which links to null-environment.

Now when I try the same thing linked against 1.6.64, either as the
precompiled jar file or with all the source code added to my project, I get
an unbound symbol exception when doing the eval. "if" is not found.

If I set a breakpoint right before executing the myInterpreter.eval, I
notice that myInterpreter . environ refers to an environment with the name
"interaction-environment.1" with no entries. The previous link of this
environment points to an environment with a sym_name of null and 193
bindings. _this_ environment points to r5rs-environment, which points to
r4rs-environment, which points to null-enviroment.

When I do the eval, I get an unbound symbol exception in
gnu.mapping.Environment.getChecked

The stack is quite long, but it looks like

kawa.standard.Scheme.eval
kawa.standard.Scheme.eval
kawa.standard.Scheme.eval
kawa.lang.Eval.evalBody
kawa.standard.Scheme.makeModuleExp
kawa.lang.Translator.finishModule
kawa.lang.Translator.rewrite
kawa.lang.Translator.rewrite_with_position
kawa.lang.Translator.rewrite_pair
kawa.lang.Translator.apply_rewrite
kawa.standard.define.rewriteForm
kawa.lang.Lambda.rewrite
kawa.lang.Translator.rewrite_body
kawa.lang.Translator.rewrite_body
kawa.lang.Translator.rewrite
kawa.lang.Translator.rewrite_with_position
kawa.lang.Translator.rewrite_pair
kawa.lang.Translator.rewrite_car
kawa.lang.Translator.rewrite_with_position
kawa.lang.Translator.rewrite
gnu.mapping.NameMap.get
gnu.mapping.Environment.getChecked

and inside getChecked, binding is coming up null where name = "if"
when this happens, "this" is pointing to an environment with a sym_name
of null, containing 3 bindings, with a previous field of null. The bindings
in this environment are "lis" and "exclude" and "exc" which are the bindings
that my code is defining. So, it appears somehow it is trying to evaluate my
code in a new environment that doesn't have the link to the previous
environments any more.

under 1.6.66, it fails with a null-pointer exception inside
kawa.lang.compileFile.readBody, and the stack looks like this:

kawa.standard.Scheme.eval
kawa.standard.Scheme.eval
kawa.standard.Scheme.eval
kawa.lang.compileFile.readBody

I know the proper way to handle environments has changed over the various
kawa revisions along with a number of class names, but I would like to be
able to use the latest kawa for better macro support.

Thanks for any ideas!

Paul

-- 
"I put Sluggo in the sink and gave him some dog food rated 'for small dogs.'
The turtles are more fun if you think of them as very small, very wet dogs."
Paul R. Potts - Technology Group Leader - Health Media Research Lab
Comprehensive Cancer Center - University of Michigan - potts@umich.edu


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