clojure-europe

For people in Europe... or elsewhere... UGT https://indieweb.org/Universal_Greeting_Time
kardan 2020-09-09T03:55:28.235800Z

Good morning

slipset 2020-09-09T05:35:11.236100Z

God morgen!

synthomat 2020-09-09T05:43:17.236300Z

good morning!

2020-09-09T06:01:14.236900Z

Bonne journée à tous !

ordnungswidrig 2020-09-09T06:28:40.237100Z

Good morning!

2020-09-09T07:23:40.237300Z

Morning

slipset 2020-09-09T07:34:13.237700Z

lost half an hour of my life on this:

(defn foo [{:keys [bar :as lol]}] lol)

slipset 2020-09-09T07:34:36.238100Z

I'm sure clj-kondo would have caught it in one way or another.

borkdude 2020-09-09T07:35:27.238300Z

yup ;)

😂 1
slipset 2020-09-09T07:47:15.239600Z

I posted a question on http://ask.clojure.org about this, since I do think this is nonsensical and could/should be caught by a destructuring-spec.

plexus 2020-09-09T08:02:34.240Z

morning!

borkdude 2020-09-09T08:12:29.240800Z

@slipset It's not nonsensical. you can use keywords in destructuring (most useful when using namespaced keywords) and treating :as as special would be surprising

slipset 2020-09-09T08:14:34.241300Z

Right,

(let [{:keys [:as]} {:as 'foo}] as)

slipset 2020-09-09T08:16:16.242700Z

I can see how this would be useful (and I have used it) with namespaced kws, but it's a bit more far fetched with non-namespaced kws.

borkdude 2020-09-09T08:16:35.243100Z

That ship has also long sailed, it's been there for a long time and won't be changed.

slipset 2020-09-09T08:16:48.243400Z

It's a linter 🙂

borkdude 2020-09-09T08:17:00.243800Z

Some people even prefer it over symbols, as it's easier to grep for keywords

slipset 2020-09-09T08:17:09.244100Z

Don't use non-namespaced keywords in :keys destructuring 🙂

borkdude 2020-09-09T08:17:09.244300Z

We use it in our codebase at work almost everywhere

borkdude 2020-09-09T08:17:39.244500Z

It can definitely be an optional linter

borkdude 2020-09-09T08:17:47.244800Z

but it's very much a taste / preference thing

borkdude 2020-09-09T08:18:17.245300Z

maybe mixed style in one destructuring can be seen as bad

borkdude 2020-09-09T08:19:23.245900Z

but clj-kondo already catches this sillyness by reporting :as as an unused binding, so I think it's sufficiently covered

1
slipset 2020-09-09T08:21:10.246100Z

true.

slipset 2020-09-09T08:22:09.246700Z

Well, I learned a couple of things, amongst them, a function called ident? which was added in 1.9

thomas 2020-09-09T09:56:19.246900Z

morning

raymcdermott 2020-09-09T14:37:06.247300Z

morning

2020-09-09T15:39:09.247500Z

👋

1
borkdude 2020-09-09T21:50:31.248100Z

morning