bug-kawa
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-kawa] [bug #47412] Can't use define in the constructor of a subclas


From: anonymous
Subject: [Bug-kawa] [bug #47412] Can't use define in the constructor of a subclass
Date: Mon, 14 Mar 2016 23:57:24 +0000
User-agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:44.0) Gecko/20100101 Firefox/44.0

URL:
  <http://savannah.gnu.org/bugs/?47412>

                 Summary: Can't use define in the constructor of a subclass
                 Project: Kawa
            Submitted by: None
            Submitted on: Mon 14 Mar 2016 11:57:23 PM UTC
                Category: Code generation
                Severity: 3 - Normal
              Item Group: Compile-time exception
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any

    _______________________________________________________

Details:

(define-simple-class A ()
        ((*init*) #!void)
)
(define-simple-class B (A)
        ((*init*)
                (invoke-special A (this) '*init*)
                (define i 0)
                (display i)
        )
)

Compiling this creates an exception:

Exception in thread "main" java.lang.Error: calling <init> on
already-initialized object
        at gnu.bytecode.CodeAttr.emitInvokeMethod(CodeAttr.java:1549)
        at gnu.expr.PrimProcedure.compileInvoke(PrimProcedure.java:770)
        at gnu.expr.PrimProcedure.compile(PrimProcedure.java:751)
        at gnu.expr.PrimProcedure.compile(PrimProcedure.java:706)
        at gnu.expr.ApplyExp.inlineCompile(ApplyExp.java:683)
        at gnu.expr.ApplyExp.compile(ApplyExp.java:245)
        at gnu.expr.ApplyExp.compile(ApplyExp.java:191)
        at gnu.expr.Expression.compileWithPosition(Expression.java:143)
        at gnu.expr.Expression.compileWithPosition(Expression.java:126)
        at gnu.expr.BeginExp.compile(BeginExp.java:146)
        at gnu.expr.Expression.compileWithPosition(Expression.java:143)
        at gnu.expr.Expression.compileWithPosition(Expression.java:126)
        at gnu.expr.LetExp.compile(LetExp.java:196)
        at gnu.expr.Expression.compileWithPosition(Expression.java:143)
        at gnu.expr.LambdaExp.compileBody(LambdaExp.java:1689)
        at gnu.expr.ClassExp.compileMembers(ClassExp.java:561)
        at gnu.expr.LambdaExp.compileEnd(LambdaExp.java:613)
        at gnu.expr.Compilation.generateBytecode(Compilation.java:2300)
        at gnu.expr.Compilation.process(Compilation.java:2174)
        at gnu.expr.ModuleInfo.loadByStages(ModuleInfo.java:302)
        at gnu.expr.ModuleExp.evalToClass(ModuleExp.java:73)
        at gnu.expr.ModuleExp.evalModule1(ModuleExp.java:246)
        at kawa.Shell.compileSource(Shell.java:557)
        at kawa.Shell.runFile(Shell.java:525)
        at kawa.Shell.runFileOrClass(Shell.java:438)
        at kawa.repl.processArgs(repl.java:678)
        at kawa.repl.main(repl.java:798)

If I just change it to a let then it works.




    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?47412>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]