This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-11-18
Channels
- # announcements (2)
- # babashka (65)
- # beginners (104)
- # boot (8)
- # calva (23)
- # circleci (3)
- # clj-commons (1)
- # clj-on-windows (3)
- # clojure (43)
- # clojure-europe (45)
- # clojure-france (2)
- # clojure-italy (3)
- # clojure-nl (3)
- # clojure-norway (13)
- # clojure-uk (4)
- # clojurescript (5)
- # core-typed (2)
- # cursive (5)
- # data-science (2)
- # datalevin (10)
- # emacs (38)
- # events (2)
- # fulcro (11)
- # graphql (6)
- # gratitude (2)
- # helix (11)
- # hugsql (3)
- # jobs (2)
- # lsp (17)
- # luminus (1)
- # malli (15)
- # missionary (3)
- # nrepl (6)
- # off-topic (6)
- # pedestal (2)
- # portal (16)
- # reagent (33)
- # reitit (4)
- # releases (12)
- # ring (2)
- # sci (3)
- # shadow-cljs (21)
- # spacemacs (7)
- # sql (5)
- # tools-build (36)
- # web-security (2)
Hi all, just recently found out about Portal and have been really enjoying exploring it.
I have a potentially silly question to ask. Let's say that I have a particularly tricky bit of code I'm trying to understand and debug that has several layers of function calls and deeply nested data structures. So I grab portal, add it as a dev dependency to the project, and start adding a bunch of tap>
calls around my production code.
When I'm done for the day, would it be okay for me to commit the added tap>
calls (as in, is their presence in production code harmless?), or should I make sure that that never makes it into production code? I suppose I'm just curious what people's workflow looks like. Do you have a local changeset that you keep your added taps in to avoid accidentally committing it? etc.. Any insight here would be wonderful.
I'm partly considering how working with other team mates might look like as well. Would you share a patch with them? or some other alternative?
I use taps like these mostly for debug, so I don't commit them, otherwise it will get noisy
Leaving taps in production code is mostly harmless (about as expensive as a logger checking current levels), but as a rule I leave very few of them in, just those that would be useful for run-time analysis of the system with an attached REPL.
I use (defonce tap! #(when nil (tap> %) %))
and just toggle nil to true when working locally
We tend to remove the calls when we're done debugging but sometimes we've left them in and committed them and they've gone to production - and that's harmless. There's virtually zero overhead calling tap>
and we have no listeners enabled in production. In other words, I wouldn't worry about it too much.
Thank you all for your input :)
I wish taps by default returned their tapped value and injected location metadata. Add to that perhaps a clojure option to turn them off globally. A macro tap can be compiled to a true noop in production
@UK0810AQ2 I believe there are plans for a tap->
in Clojure 1.11
that would be great, I miss that a lot too
@U04V70XH6 I like that pattern, gonna use it 🙂
I was creating a live template to get it quicker, than I realize I had this Live template (snippet) already, just forgot it 😅