This is the mail archive of the kawa@sourceware.org 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]
Other format: [Raw text]

Re: Some other oddities


On May 30, 2006, at 8:29 PM, Per Bothner wrote:

50% faster than "full, reasonably optimized Java" is quite impressive

Sorry: 1.25 to 1.5 *slower*. :-) Which for scheme is still _really_ good! Consider: python is typically almost exactly 10 times slower than Java in almost all of my work...



1. The documentation says that to access fields defined in Scheme in a simple-class, you have to use (slot-ref foo 'bar), but for standard Java classes you can use (#:.bar foo).

Where does it say that? If you're look at the 2d-vector example, you're
misunderstanding it.

I am. Thanks for setting me straight, I've got that cleaned up now.



2. Load order for mutually-referential simple-classes seems to be broken, or at least inconsistent in an undocumented way.

The problem is the semantics of "load". It is defined to read and evaluate the expressions in order, which means limited support for forward references.

If you *compile* a module that define two mutually references classes,
I believe that should work.

Actually, I'm failing on loading classes compiled to .class files as well. (I'm using the CVS version as of a few days ago). My <tutorial1> and <ca> classes now how the following mutual references:


    (define-simple-class <tutorial1> (<sim.engine.SimState>)
        ((start) :: <void> ....
            (make <ca>) ....

    (define-simple-class <ca> (<sim.engine.Steppable>)
        ((step (state :: <sim.engine.SimState>)) :: <void> ....
            (temp-grid:setTo (<tutorial1>:.grid state)) ....

Each compiles clean with no errors. Now if I have a file run1.scm which has

(load "tutorial1.class")
(load "ca.class") ;; doesn't matter if it's here, error still happens
... then do other stuff if I get here, doesn't matter, error still happens...


... when I run java kawa.repl run1.scm, I get a death on trying to load tutorial1.class:

java.lang.RuntimeException: class not instantiable: in load
        at kawa.standard.load.loadClassFile(load.java:48)
        at kawa.standard.load.apply(load.java:203)
        at kawa.standard.load.apply2(load.java:152)
        at kawa.standard.load.apply1(load.java:142)
        at gnu.mapping.Procedure.apply(Procedure.java:145)
        at gnu.mapping.Procedure.apply(Procedure.java:128)
        at gnu.mapping.CallContext.runUntilDone(CallContext.java:251)
        at gnu.expr.ModuleExp.evalModule(ModuleExp.java:268)
        at kawa.Shell.run(Shell.java:230)
        at kawa.standard.load.loadSource(load.java:114)
        at kawa.standard.load.apply(load.java:233)
        at kawa.Shell.runFile(Shell.java:305)
        at kawa.repl.main(repl.java:839)

I seem unable to load tutorial1 when compiled, though it runs fine when loaded as an .scm file, albeit with the load ordering problem described earlier.


> or is it the case (which, btw, appears to be NECESSARY
if I want to call a function on the tutorial1 method that doesn't exist in its superclass -- very un-scheme-like :-( )

Not sure what if anything you're asking for here.

case -> cast [sorry]


I had meant that saying (<foo>:bar baz quux) [e.g., casting baz into a <foo> class before calling] seemed to be less schemelike than saying (baz:bar quux) and letting the system fail at runtime if baz doesn't actually have a method called foo in it. Unless doing so would mean some efficiency loss I guess...

Sean


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