Fork me on GitHub

expectations/clojure-test {:mvn/version "1.2.1"} -- clojure.test-compatible version of Expectations -- all new documentation -- several enhancements -- follow-up on #expectations (expect a lot more activity on this library going forward!)

🙌 16

I’ve just published Postmortem, a tiny value-oriented debugging tool for Clojure(Script)! • Postmortem is heavily inspired by scope-capture and, but focuses more on “postmortem debugging” as its name suggests. • Integration with transducers enables various flexible logging strategies • Instrumentation on vars makes it easier to debug functions without touching their code • Supports Clojure/ClojureScript/self-hosted ClojureScript If you’re interested, give it a shot! Any feedback is welcome.

👍 28
👀 8

Interesting! Perhaps a Rationale section would help, explaining how it compares to alternatives (I see that hinted in Features, but still... ^^)

Filipe Silva14:12:26

I was looking for something of this sort, although now I know scope-capture also existed

Filipe Silva14:12:37

postmortem seems more full featured though

Filipe Silva14:12:39

and also seems to have a bit more focus on working with cljs

Filipe Silva14:12:40

the instrumentation bit also looks right like what I really wanted


@U45T93RA6 Hi, thanks! Yeah, I admit the current document is still hard to grasp what the library does really aim at, so I’ll try to improve it sometime soon. @UJVKWJTGE Thank you for the feedback! I hope it’ll be useful for your use case.

✌️ 4

@U0508956F Hello, scope-capture's author here (thanks for mentioning it, I'm glad it gave you some inspiration!) I don't see much overlap between both libraries. scope-capture is above all about recreating the context of your code and projecting your REPL into it, and really not much about dealing with saved values. As such, Postmortem seems more akin to tracing debuggers, like tools.trace or Sayid (which is also very feature complete!). @UJVKWJTGE: FYI scope-capture does work with ClojureScript.


Might want to add Postmortem to the Clojure Toolbox!


Also, I think not everyone knows about this, but there's a section about debugging in the REPL guide on, it might be useful as an overview of the available options:


@U06GS6P1N Hi, thanks for your suggestions! Yes, I know the Clojure Toolbox, but I thought for no reason that it’s not actively maintained anymore. I will file a PR for Postmortem later 😉


> I don’t see much overlap between both libraries. scope-capture is above all about recreating the context of your code and projecting your REPL into it, and really not much about dealing with saved values. Once you save a local context as data, you can freely use that data later. Evaluating an expression in a reproduced context is one of the use cases for the saved data. Although Postmortem does not provide dedicated APIs for that, it could be done with relatively small effort using the existing APIs for most simple cases. For example, the last expression in the following code effectively works like scope-capture’s letsc:

(require '[postmortem.core :as pm])

(defn sum [n]
  (loop [n n sum 0]
    (pm/dump :sum)
    (if (= n 0)
      (recur (dec n) (+ sum n)))))

(sum 10) ;=> 55

;; This evaluates (+ sum n) with the local context of the 7th iteration
(let [{:keys [sum n]} (-> (pm/log-for :sum) (nth 7))]
  (+ sum n))

Filipe Silva11:12:45

didn't know about that section, but unfortunately tools.trace doesn't seem to support cljs and that's one of the most useful ones I feel 😞

Filipe Silva11:12:45

in fact, in clojure-toolsbox I see that scope-capture is the only debugging tool marked as cljs even


@U0508956F some would argue that for the most simple cases, you don't need a lib at all, you can just use the inline-def trick

Filipe Silva15:12:53

I meant the "Debugging" section though

Filipe Silva15:12:24

dirac is listed in "ClojureScript Development" it seems


Clojure/north call for papers is open 🎉

👀 12
🍁 16

New release of libpython-clj (1.20)! Thanks to help by jjtolton, joinr, and gilch and a few others we have two large new pieces that move us measurably closer to having a great Python development/production environment in Clojure. The changelog has the details but we now support require-python that works just like require. It does an initialize call if one isn't done already, loads the module into a namespace, and then does the 'require' of that namespace into your current one. It supports 'reload' for when you are developing a new python module to make it smoother to develop new functionality in Python. We also support creating python classes in clojure. So you can create a new python class purely in clojure that will call into your clojure functions including the 'self' argument. This allows us to interact with toolkits that require extension-by-derivation and is also just kind of fun to use. It's up on Clojars now, Enjoy!! <>

👏 56
👍 20
🙏 4
🙈 4

State of JavaScript survey is out (For the past 3 years, ClojureScript users who answered the survey made up 1% of the respondents. Maybe this year we can top that hint, hint 😉)

👍 20