You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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])
(defndo-something [x] x)
(manage [:x (pc/result!"nevermind")]
(do-something3))
;; => 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:
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.
The text was updated successfully, but these errors were encountered:
Side note: the Clojars link in the readme points to an outdated version of the library with the conditions namespace, also used by the Nextjournal tutorial.
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)
It appears that the library macros (
manage
,retryable
) are only able to work when given unqualified symbols:pure-conditioning/src/pure_conditioning/core.clj
Line 192 in 66061cb
Figuring this out was pretty confusing, as there are actual
result!
andretry!
vars defined in thepure-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.The text was updated successfully, but these errors were encountered: