Skip to content

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

@or

Description

@or

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions