H!
I've been trying to use coroutines for Clojure.
I found that your library is promising.
But Clojure's compiler makes slightly different bytecode than Java does.
(defn x []
(let [my-coroutine (reify Coroutine
(run [_ c]
(.suspend c)))
r (CoroutineRunner. my-coroutine)]
(doto r
(.execute))))
The compiler produces this bytecode
public void run(com.offbynull.coroutines.user.Continuation) throws java.lang.Exception;
Code:
0: aload_1
1: aconst_null
2: astore_1
3: checkcast #30 // class com/offbynull/coroutines/user/Continuation
6: invokevirtual #33 // Method com/offbynull/coroutines/user/Continuation.suspend:()V
9: aconst_null
10: pop
11: return
Java Decompiler decompiles it to the following Java code
public void run(Continuation c) throws Exception {
c = null; // wrong decompilation
c.suspend();
null;
}
I think that the decompiler is wrong because every Java method call in Clojure has the same bytecode.
So the bytecode is correct.
But when I run the code I've got a NullPointerException on the (.suspend c) line.
Maybe this library has the same mistake?
H!
I've been trying to use coroutines for Clojure.
I found that your library is promising.
But Clojure's compiler makes slightly different bytecode than Java does.
The compiler produces this bytecode
Java Decompiler decompiles it to the following Java code
I think that the decompiler is wrong because every Java method call in Clojure has the same bytecode.
So the bytecode is correct.
But when I run the code I've got a NullPointerException on the
(.suspend c)line.Maybe this library has the same mistake?