-
Notifications
You must be signed in to change notification settings - Fork 1
Description
I've always been interested to explore CL-style condition systems, thanks for bringing some form of it over to Clojure :)
Here's a repro (adapted from the readme)
(require '[pure-conditioning :as pc])
(defn do-something [x] x)
(manage [:x (pc/result! "nevermind")]
(do-something 3))
;; => Execution error (ExceptionInfo) at pure-conditioning.core/result! (core.clj:277).
;; result! must be used within manage, retryable or retryable-fn* blocks.It appears that the library macros (manage, retryable) are only able to work when given unqualified symbols:
| (if (and (list? f) (#{'result! 'retry!} (first f))) |
Figuring this out was pretty confusing, as there are actual result! and retry! vars defined in the pure-conditioning.core namespace (I assume for dev tooling affordances?) But it turns out that the library doesn't care whether they exist or were imported in the current namespace, essentially treating the bare symbols as anaphors.
Not that unhygenic DSLs are a bad thing, but perhaps this fact should be made more explicit in the docstrings / Readme? From a syntax perspective I guess there would be less of a surprise if they were given more DSL-y names like !retry or $retry.. Going the pseudo-hygenic route might be possible too by somehow resolving the vars using &env at macroexpansion time.