ghostwheel

Hassle-free clojure.spec, automatic generative testing, side effect detection, and evaluation tracing for Clojure(-Script) – https://github.com/gnl/ghostwheel
wilkerlucio 2019-06-03T02:35:34.000800Z

hello, I started using ghostwheel, but I'm trying to write a recursive function and something is getting wrong

wilkerlucio 2019-06-03T02:35:53.001200Z

I tried this example to simplify the reproduction:

wilkerlucio 2019-06-03T02:35:54.001500Z

(>defn recursive
  [x]
  [int? => int?]
  (if (> x 0)
    (recursive (dec x))
    x))

wilkerlucio 2019-06-03T02:36:02.001800Z

this leads to:

wilkerlucio 2019-06-03T02:36:03.002Z

16 |   [x]
  17 |   [int? => int?]
  18 |   (if (> x 0)
  19 |     (recursive (dec x))
------------^-------------------------------------------------------------------
 Use of undeclared Var com.wsscode.wise.client.ui.structure-importer/recursive
--------------------------------------------------------------------------------
  20 |     x))
  21 |
  22 | (defn render-shape!
  23 |   [this query path]
--------------------------------------------------------------------------------

wilkerlucio 2019-06-03T02:41:57.002300Z

seems related to tracing feature, when I disabled tracing it compiles fine

gnl 2019-06-03T12:37:06.002700Z

@wilkerlucio Can you post your Ghostwheel config here? (Everything relevant / active, external config, ghostwheel.edn, namespace metadata)

gnl 2019-06-03T12:38:17.002900Z

Will be releasing 0.4.0 soon, hopefully we can figure this one out quickly and the fix makes it in there.

gnl 2019-06-03T12:39:53.003100Z

The simplest explanation off the top of my head is that clairvoyant isn't compatible with recursive functions, which would suck, but let's see. I was just patching a few things there.

gnl 2019-06-03T12:45:07.003400Z

By the way, tracing is much improved in 0.4.0, output is much cleaner and more readable and it is more granular as well.

gnl 2019-06-03T12:47:15.003600Z

Actually hold off on the config, might be no need, I'm gonna check this with recursive functions in general first.

gnl 2019-06-03T22:10:12.003800Z

@wilkerlucio Fixed in 0.4.0 – the tracing code generates 2 different functions in order to be able to dynamically switch between a traced and untraced version at runtime as needed and it broke for recursive functions, because the one defined before was trying to call the one defined after. A simple declare solved it. New release coming up in the next few days, maybe tomorrow. If you want to trace until then, just add a simple (declare recursive) before the (>defn ...

wilkerlucio 2019-06-03T22:11:17.004500Z

nice! thanks for looking so quickly in it :)

gnl 2019-06-03T22:13:01.004700Z

No problem, it was pretty good timing actually, cause I was just knee-deep in the tracing code and rewriting half of it. 🙂

gnl 2019-06-03T22:13:50.004900Z

Will announce here, when it's out.