I don’t like Clojure destructuring putting map keys after the vars to bind them to. There must’ve been some really compelling reason to do it this way, but oh god, it’s extremely broken and unjustifiable to me.
JS got it right.
I don’t like Clojure destructuring putting map keys after the vars to bind them to. There must’ve been some really compelling reason to do it this way, but oh god, it’s extremely broken and unjustifiable to me.
JS got it right.
@muhanga @aartaka Presumably referring to this:
(let [{resp-body :body} {:status 200 :body "Hello World"}]
resp-body) ; => "Hello World"
I imagine it feels odd because the (binding) key / val are reversed from the data being bound. (`[{a :a} {:a 1}]`).
Not entirely obvious to me that that *couldn't* have been done in the other order. OTOH, it does feel natural to keep the bound names to the left in a binding form.
@camdez @aartaka
Yeah, ouch, my brain really did not like this, so I can fully understand not liking this.
And this is why I removed knowledge from my head about this de-structuring pattern even existing in the clojure.
Most of the time the `{:keys [body]} m` de-structuring should work for me, when it don't I would say I am doing something clearly beyond my level of comprehension and I should probably stop.
@aartaka @muhanga Weird string keys are definitely annoying… once you’ve gone down the keyword route, you sure wish everyone else had too.
The destructuring syntax honestly doesn’t bother me anymore (after years of using it, to be fair), though it does get hard to read with a lot of nesting, and I occasionally battle with myself about how I want to indent it (being a person who usually likes to align keys across lines).