clojurescript

valerauko 2025-03-17T14:27:49.534609Z

I've been trying to play around with reitit's frontend and I ran into the same problem as before with a protocol dispatch. I made a minimal repro at https://github.com/valerauko/proto-repro/commit/a8ad51a225ed44ed134b28a18cc83d272d0d8321 Can someone explain why it's not working?

valerauko 2025-03-17T14:42:40.911159Z

it looks like the 3ary protocol function is trying to dispatch on its last argument instead of the first and i can't find what i'm doing wrong

p-himik 2025-03-17T14:43:15.168239Z

Try using real parameter names instead of _.

❤️ 1
valerauko 2025-03-17T14:47:03.312529Z

what the

valerauko 2025-03-17T14:47:52.452679Z

Indeed that solved it. Can you explain why that happens? Is that some thing about the way protocol bindings are done in cljs?

valerauko 2025-03-17T14:49:21.974029Z

I absolutely would not expect the arg names specified at the defprotocol to affect the actual bindings when calling or in extend-protocol

p-himik 2025-03-17T14:49:51.768149Z

I just mentioned it in #cljs-dev, probably a bug worth fixing. Feel free to create a post on http://ask.clojure.org - I'll link it there as well if you do. I think what's going on is that _ remains _ and just overrides previous values before the protocol dispatch happens. Conceptually, something like this:

(defn -href [& args]
  (let [_ (first args)
        _ (second args)
        _ (nth args 2)]
    (dispatch-proto Linkable _ args)))

Drew Verlee 2025-03-17T22:08:10.332129Z

What do you use for production browser logging? Sentry? Telemere? Glogi? (feel free to give a very flippant response!)

p-himik 2025-03-17T22:28:17.003509Z

Sentry.

cjohansen 2025-03-18T05:15:19.322099Z

window.addEventListener("uncaughtException") (and unhandled rejections) plus some custom code. We report every error directly to slack and have a zero production error policy.

thheller 2025-03-18T05:46:28.786309Z

windor.onerror to post client side errors to server. no other logging 😛

👌 1
cjohansen 2025-03-18T05:49:21.632129Z

That's basically what I meant 😊