[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug-kawa] [bug #23606] define-simple-class breaks in conjunction with d
From: |
anonymous |
Subject: |
[Bug-kawa] [bug #23606] define-simple-class breaks in conjunction with define-syntax. define-class breaks in a different way still. |
Date: |
Mon, 16 Jun 2008 17:44:56 +0000 |
User-agent: |
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_4_11; en) AppleWebKit/525.18 (KHTML, like Gecko) Version/3.1.1 Safari/525.18 |
URL:
<http://savannah.gnu.org/bugs/?23606>
Summary: define-simple-class breaks in conjunction with
define-syntax. define-class breaks in a different way still.
Project: Kawa
Submitted by: None
Submitted on: Monday 06/16/2008 at 17:44 UTC
Category: Code generation
Severity: 3 - Normal
Item Group: Run-time exception
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
If I create an object like this:
(define-simple-class <bar> ()
((step)
(stepit))
((stepit)
(write "bar works great")))
(set! b (<bar>))
(b:step)
... everything works fine. But if I take part of it and move it into a macro
using define-syntax like this:
(define-syntax define-agent
(syntax-rules ()
((_ agent-name rest ...)
(define-simple-class agent-name ()
((step)
(stepit))
rest ... ))))
(define-agent <foo>
((stepit)
(write "foo doesn't work")))
(set! f (<foo>))
(f:step)
I get the following error:
unbound location stepit
at gnu.mapping.Location.get(Location.java:67)
at foo.step(stdin:21)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at gnu.expr.PrimProcedure.apply(PrimProcedure.java:254)
at gnu.mapping.CallContext.runUntilDone(CallContext.java:251)
at gnu.expr.ModuleExp.evalModule(ModuleExp.java:309)
at kawa.Shell.run(Shell.java:275)
at kawa.Shell.run(Shell.java:186)
at kawa.Shell.run(Shell.java:167)
at kawa.repl.main(repl.java:870)
To see what's happening, I compiled to a class file. On examination, it
appears that in the second situation, 'step' is not compiling to a method --
it's compiling to a field. That wouldn't be right.
I then tried using define-class instead of define-simple-class:
(define-syntax define-agent-2
(syntax-rules ()
((_ agent-name rest ...)
(define-class agent-name ()
((step)
(stepit))
rest ... ))))
(define-agent-2 <baz>
((stepit)
(write "baz doesn't work")))
(set! bz (<baz>))
(bz:step)
... but when I do that I get a compile error:
internal compile error - caught java.lang.Error: emitInvokeXxx static flag
mis-match method.flags=1
gnu.bytecode.CodeAttr.emitInvokeMethod(CodeAttr.java:1304)
gnu.bytecode.CodeAttr.emitInvokeStatic(CodeAttr.java:1355)
gnu.expr.ClassExp.compileMembers(ClassExp.java:615)
gnu.expr.ClassInitializer.<init>(ClassInitializer.java:16)
gnu.expr.ClassExp.compileSetField(ClassExp.java:758)
gnu.expr.SetExp.compile(SetExp.java:170)
gnu.expr.Expression.compileNotePosition(Expression.java:157)
gnu.expr.Expression.compileWithPosition(Expression.java:143)
gnu.expr.LambdaExp.compileBody(LambdaExp.java:1586)
gnu.expr.Compilation.generateBytecode(Compilation.java:2028)
gnu.expr.Compilation.process(Compilation.java:1902)
gnu.expr.ModuleInfo.loadByStages(ModuleInfo.java:315)
gnu.expr.ModuleExp.evalToClass(ModuleExp.java:73)
gnu.expr.ModuleExp.evalModule(ModuleExp.java:228)
kawa.Shell.run(Shell.java:275)
kawa.Shell.run(Shell.java:186)
kawa.Shell.run(Shell.java:167)
kawa.repl.main(repl.java:870)
I then tried just using define-class directly without define-syntax:
(define-class quux ()
((step)
(stepit))
((stepit)
(write "quux doesn't work")))
(set! q (<quux>))
(q:step)
... and interestingly enough I get ANOTHER DIFFERENT compile-time error:
internal compile error - caught java.lang.Error: popType called with empty
stack quux$class.step(quux)java.lang.Object
gnu.bytecode.CodeAttr.popType(CodeAttr.java:316)
gnu.bytecode.CodeAttr.emitInvokeMethod(CodeAttr.java:1316)
gnu.expr.PrimProcedure.compileInvoke(PrimProcedure.java:543)
gnu.expr.PrimProcedure.compile(PrimProcedure.java:525)
gnu.expr.PrimProcedure.compile(PrimProcedure.java:494)
gnu.expr.ApplyExp.compile(ApplyExp.java:171)
gnu.expr.ApplyExp.compile(ApplyExp.java:110)
gnu.expr.Expression.compileNotePosition(Expression.java:157)
gnu.expr.Expression.compileWithPosition(Expression.java:143)
gnu.expr.LambdaExp.compileBody(LambdaExp.java:1586)
gnu.expr.ClassExp.compileMembers(ClassExp.java:525)
gnu.expr.ClassInitializer.<init>(ClassInitializer.java:16)
gnu.expr.ClassExp.compileSetField(ClassExp.java:758)
gnu.expr.SetExp.compile(SetExp.java:170)
gnu.expr.Expression.compileNotePosition(Expression.java:157)
gnu.expr.Expression.compileWithPosition(Expression.java:143)
gnu.expr.LambdaExp.compileBody(LambdaExp.java:1586)
gnu.expr.Compilation.generateBytecode(Compilation.java:2028)
gnu.expr.Compilation.process(Compilation.java:1902)
gnu.expr.ModuleInfo.loadByStages(ModuleInfo.java:315)
gnu.expr.ModuleExp.evalToClass(ModuleExp.java:73)
gnu.expr.ModuleExp.evalModule(ModuleExp.java:228)
kawa.Shell.run(Shell.java:275)
kawa.Shell.run(Shell.java:186)
kawa.Shell.run(Shell.java:167)
kawa.repl.main(repl.java:870)
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?23606>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Bug-kawa] [bug #23606] define-simple-class breaks in conjunction with define-syntax. define-class breaks in a different way still.,
anonymous <=