This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-10-05
Channels
- # beginners (46)
- # calva (89)
- # cider (24)
- # clara (7)
- # clj-kondo (36)
- # clojure (33)
- # clojure-australia (4)
- # clojure-dev (9)
- # clojure-europe (15)
- # clojure-israel (1)
- # clojure-nl (1)
- # clojure-uk (13)
- # clojurescript (55)
- # community-development (38)
- # conjure (1)
- # cryogen (12)
- # cursive (16)
- # data-science (4)
- # datomic (39)
- # events (2)
- # fulcro (5)
- # gorilla (3)
- # introduce-yourself (3)
- # jobs (9)
- # kaocha (5)
- # malli (16)
- # music (12)
- # off-topic (11)
- # polylith (4)
- # react (4)
- # reactive (1)
- # reagent (18)
- # remote-jobs (2)
- # reveal (2)
- # sci (4)
- # shadow-cljs (31)
- # timbre (4)
- # tools-build (70)
- # tools-deps (11)
- # vim (33)
- # xtdb (53)
we're pretty heavy users of manifold, and use it's version of recur from time to time
but then the new linter will complain because it doesn't recognise the d/recur statement as a valid recur
I've taken a look at the code for the linter, but couldn't immediately see where it goes wrong
on closer inspection (trying make a minimal reproduction case), it's probably more due to some other deferred control flow mechanisms
but it gets confused if it's part of a d/catch (which takes a function), or if the d/recur is wrapped in a function that schedules it after a timeout
perhaps it's better to just write a hook for d/loop
then. hooks have gotten a little easier with the new :macroexpand
option
yeah, I think I'd actually have to write hooks for the control flow mechanisms (kondo also doesn't recognize normal loop and recur here)
I was just thinking out loud: the root cause is that kondo doesn't really understand that the arguments to stuff like d/catch are called later
the example I gave earlier with mt/in is one -> kondo doesn't realize d/recur is executed later, I'll prepare a gist with d/catch
essentially this retries a request infinitely until it succeeds, throttled by a rate-limiter
could you add require etc so I can understand what clj-kondo does not lint correctly?
E.g. I don't see any warnings here:
(ns private.tmp.repro
(:require d log http))
(defn run-with-rl [x y] x y)
(declare endpoint http-opts bucket)
(d/loop []
(->
(d/chain (run-with-rl (partial http/get endpoint http-opts) bucket)
:body)
(d/catch #(do (log/error "failed to execute request:" %)
(d/recur)))))
indeed, I don't think it's reasonable to expect kondo to figure this out (without some serious hints from hooks)