convex icon indicating copy to clipboard operation
convex copied to clipboard

Error in argument compilation

Open Darkneew opened this issue 3 years ago • 1 comments

There is an error which I guess comes from argument compilation. However, I don't know how the reader and parser work, so I can only show how to reproduce the error.

First, I define an actor with an eval callable function:

(def actor (deploy `(
    defn eval ^{:callable? true} [code] (
        if (= *caller* ~*address*) 
            (eval-as *address* code) 
            (fail :UNAUTHORIZED "access not granted")
    )
)))

Then, I create a function that use a variable in actor, using the eval function

(call actor (eval `(
    defn identity [arg] arg
)))

Finally, I run the function with some value

(actor/identity 1)

And instead of returning 1, it returns

(defn identity [arg] arg)

Darkneew avatar Aug 03 '22 03:08 Darkneew

Interesting one. Let me check and get back on this!

mikera avatar Aug 22 '22 15:08 mikera