convex icon indicating copy to clipboard operation
convex copied to clipboard

when-let() and if-let() in convex-scrypt causes fatal error

Open billbsing opened this issue 4 years ago • 2 comments

when-let and if-let return Fatal errors java.lang.IndexOutOfBoundsException when called with no parameters

_transaction_submit: FATAL java.lang.IndexOutOfBoundsException: Index: -1
        at convex.core.data.VectorLeaf.get(VectorLeaf.java:181)
        at convex.core.data.List.get(List.java:80)
        at convex.core.data.ASequence.get(ASequence.java:91)
        at convex.core.lang.Compiler.compileLet(Compiler.java:380)
        at convex.core.lang.Compiler.compileList(Compiler.java:355)
        at convex.core.lang.Compiler.compileCell(Compiler.java:135)
        at convex.core.lang.Compiler.compile(Compiler.java:102)
        at convex.core.lang.Context.compile(Context.java:1062)
        at convex.core.lang.Compiler.compileAll(Compiler.java:122)
        at convex.core.lang.Context.compileAll(Context.java:1243)
        at convex.core.lang.Compiler.compileList(Compiler.java:369)
        at convex.core.lang.Compiler.compileCell(Compiler.java:135)
        at convex.core.lang.Compiler.compile(Compiler.java:102)
        at convex.core.lang.Compiler.expandCompile(Compiler.java:85)
        at convex.core.lang.Context.expandCompile(Context.java:1039)
        at convex.core.lang.Context.eval(Context.java:1135)
        at convex.core.transactions.Invoke.apply(Invoke.java:103)
        at convex.core.State.applyTransaction(State.java:423)
        at convex.core.State.applyTransaction(State.java:387)
        at convex.core.State.applyTransactions(State.java:348)
        at convex.core.State.applyBlock(State.java:237)
        at convex.core.Peer.updateBelief(Peer.java:327)
        at convex.core.Peer.mergeBeliefs(Peer.java:302)
        at convex.peer.Server.maybeMergeBeliefs(Server.java:524)
        at convex.peer.Server.maybeUpdateBelief(Server.java:434)
        at convex.peer.Server$4.run(Server.java:713)
        at java.base/java.lang.Thread.run(Thread.java:829)

************************************************************************************************************************************
when-let( )
************************************************************************************************************************************
_transaction_submit: FATAL java.lang.IndexOutOfBoundsException: Index: -1
        at convex.core.data.VectorLeaf.get(VectorLeaf.java:181)
        at convex.core.data.List.get(List.java:80)
        at convex.core.data.ASequence.get(ASequence.java:91)
        at convex.core.lang.Compiler.compileLet(Compiler.java:380)
        at convex.core.lang.Compiler.compileList(Compiler.java:355)
        at convex.core.lang.Compiler.compileCell(Compiler.java:135)
        at convex.core.lang.Compiler.compile(Compiler.java:102)
        at convex.core.lang.Context.compile(Context.java:1062)
        at convex.core.lang.Compiler.compileAll(Compiler.java:122)
        at convex.core.lang.Context.compileAll(Context.java:1243)
        at convex.core.lang.Compiler.compileList(Compiler.java:369)
        at convex.core.lang.Compiler.compileCell(Compiler.java:135)
        at convex.core.lang.Compiler.compile(Compiler.java:102)
        at convex.core.lang.Compiler.expandCompile(Compiler.java:85)
        at convex.core.lang.Context.expandCompile(Context.java:1039)
        at convex.core.lang.Context.eval(Context.java:1135)
        at convex.core.transactions.Invoke.apply(Invoke.java:103)
        at convex.core.State.applyTransaction(State.java:423)
        at convex.core.State.applyTransaction(State.java:387)
        at convex.core.State.applyTransactions(State.java:348)
        at convex.core.State.applyBlock(State.java:237)
        at convex.core.Peer.updateBelief(Peer.java:327)
        at convex.core.Peer.mergeBeliefs(Peer.java:302)
        at convex.peer.Server.maybeMergeBeliefs(Server.java:524)
        at convex.peer.Server.maybeUpdateBelief(Server.java:434)
        at convex.peer.Server$4.run(Server.java:713)
        at java.base/java.lang.Thread.run(Thread.java:829)

************************************************************************************************************************************
if-let( )
************************************************************************************************************************************

billbsing avatar May 12 '21 08:05 billbsing

Can you find an equivalent issue in Convex Lisp? Need to know what form is failing... currently (when-let) and similar seem to return regular ARITY errors.

mikera avatar May 12 '21 09:05 mikera

If you do when_let() instead it fails correctly as the same as convex-lisp (when-let), so I think it is the parsing of the - symbol and passing the statement directly over to convex-lisp

billbsing avatar May 12 '21 10:05 billbsing