day8 / re-frame-debux

A fork of debux for tracing re-frame code (for eventual consumption by re-frame-10x)
Eclipse Public License 1.0
43 stars 7 forks source link

`fn-traced`/`defn-traced` expansion doesn't seem to terminate with `loop` & `recur` in the body #40

Open or opened 3 years ago

or commented 3 years ago

Evening, folks.

I'm using shadow-cljs 2.12.7, re-frame/tracing 0.6.2.

I wanted to use fn-traced for all my events and noticed that the compilation suddenly kept my CPU busy indefinitely, I always had to kill the process. Then I was able to narrow it down to one event that used a loop, and indeed that was the one responsible.

I can reproduce it with this:

(macroexpand-all
  '(day8.re-frame.tracing/fn-traced []
      (loop [n 10]
        (when (pos? n)
          (recur (dec n))))))

The recur seems to be the culprit or at least a necessary abettor, because this is fine:

(macroexpand-all
  '(day8.re-frame.tracing/fn-traced []
      (loop [n 10]
        (when (pos? n)
          :boring-loop
          #_(recur (dec n))))))

With youthful recklessness and delusions of grandeur I looked through the code, hoping I could provide a PR and make new friends, but soon had to face reality: someone who knows what s/he is doing is needed.

At the same time I think it unlikely to be the first person to run into this, but maybe loops aren't so common in most event handlers?

jordan-yee-dividend commented 1 year ago

This seems related to https://github.com/Day8/re-frame-debux/issues/6