This is the mail archive of the
kawa@sources.redhat.com
mailing list for the Kawa project.
'require' crashes inside functions
- To: kawa at sourceware dot cygnus dot com
- Subject: 'require' crashes inside functions
- From: Jocelyn Paine <popx at pop3 dot ifs dot org dot uk>
- Date: Fri, 24 Aug 2001 00:15:33 +0100 (GMT)
What are the restrictions on where 'require' can be
used? If I define a list to be this lambda-expression:
(lambda (page)
(require <kb7.mm3.general.Terms>)
(display "HELLO")
(display (make-term "t" 1 2 3)) <-- defined in that required class.
(display "BYE")
)
then Kawa crashes when I try to make a function from it
by calling eval:
java.lang.Error: popType called with empty stack ClassType atEvalLevel
lambda1
Java.lang.Object)java.lang.Object
at gnu.bytecode.CodeAttr.popType(Compiled Code)
at gnu.bytecode.CodeAttr.emitPutField(CodeAttr.java:958)
at gnu.expr.Declaration.compileStore(Compiled Code)
at gnu.expr.Declaration.initBinding(Compiled Code)
at gnu.expr.LetExp.store_rest(Compiled Code)
at gnu.expr.LetExp.compile(Compiled Code)
at gnu.expr.Expression.compileWithPosition(Compiled Code)
at gnu.expr.LambdaExp.compileAsMethod(Compiled Code)
at gnu.expr.LambdaExp.compileSetField(LambdaExp.java:577)
at gnu.expr.LambdaExp.compile(LambdaExp.java:673)
at gnu.expr.Expression.compileWithPosition(Compiled Code)
at gnu.expr.Compilation.addClass(Compiled Code)
at gnu.expr.Compilation.<init>(Compilation.java:631)
at gnu.expr.ModuleExp.evalToClass(Compiled Code)
at gnu.expr.ModuleExp.eval(ModuleExp.java:38)
at gnu.expr.ModuleExp.evalModule(ModuleExp.java:180)
at kawa.lang.Eval.evalBody(Eval.java:60)
at kawa.lang.Eval.eval(Eval.java:24)
at kawa.lang.Eval.eval(Eval.java:40)
at kawa.lang.Eval.apply1(Eval.java:71)
at atInteractiveLevel.pageFileToFunction(Unknown Source)
at atInteractiveLevel.apply1(Compiled Code)
at gnu.expr.ModuleBody.applyN(ModuleBody.java:119)
at gnu.expr.ModuleMethod.applyN(ModuleMethod.java:61)
at gnu.expr.ApplyExp.eval(Compiled Code)
at gnu.expr.ApplyExp.eval(Compiled Code)
at gnu.expr.ModuleExp.evalModule(ModuleExp.java:177)
at kawa.Shell.run(Compiled Code)
at kawa.Shell.run(Shell.java:35)
at kawa.repl.apply0(repl.java:27)
at gnu.mapping.Future.run(Future.java:59)
What I was doing was thinking about how one might implement a system
similar to BRL in Kawa, by compiling Web pages directly into function
definitions, callable from a transition-network interpreter that
implements the transitions between pages. I convert each page definition
into a lambda-expression, and call it to generate the output. Many pages
will refer to modules that I've previously defined in other applications,
and for these, I have to be able to read a list of the required modules
and then load them. Evidently, putting their 'require' expressions
inside the function doesn't work. Should it?
Jocelyn Paine
http://www.ifs.org.uk/~popx/
+44 (0)7768 534 091