datomic

wevrem 2026-01-27T19:46:14.801289Z

From sad experience, I've trained myself to avoid :db/ident's where if you strip off the namespace, you're left with a name that is the same as a clojure.core function. For example, say you have some idents in your schema such as :client/name, :client/key, and :client/unique and you have a function that destructures a client:

(defn client-thing [{:client/keys [key name unique]}]
  [key name unique])
Then maybe things change and your function doesn't need to access all of the fields of client. If you remove unique from the destructure, the analyzer/linter will warn you, and the thing won't compile.
(defn client-thing [{:client/keys [key name #_unique]}]
  [key name unique])   ;; error squiggles under unresolved symbol 'unique'
But if you drop either key or name (forgetting to change the body), there will be no warning, no squiggles, and even if it compiles, your program will clearly be wrong. Anyone else faced this? How do you handle it?

yannvahalewyn 2026-01-28T09:11:48.341689Z

title is also a useful alternative to name sometimes If I have to work with something that has a :client/key or :client/name, I tend to not destructure and use the whole keyword to access the fields. If I need to destructure I'd use {client-name :client/name client-key :client/key}. I also have been bitten a few times by strange errors so now I prefer to work around shadowing, when possible

Dave Liepmann 2026-01-28T09:18:23.377939Z

oh this is handy too https://guide.clojure.style/#idiomatic-names

👌 1
michaelwhitford 2026-01-27T21:36:34.219289Z

The only one that really annoys me is name, so i just use that and call clojure.core/name when I want the function. It's really hard to not call a name of a thing name as a label.

2026-01-27T22:06:54.315769Z

I have been bitten by this. I usually do label or display-name , kind instead of type, ...

2026-01-27T22:16:47.615649Z

I never shadow symbols

➕ 1
2026-01-27T22:17:36.854749Z

{k :client/keys, n :client/name, u :client/unique}

2026-01-27T22:18:02.108009Z

I've been bitten too many times. I just avoid it.

2026-01-27T22:18:24.966509Z

ima guess that this is a thing clj-kondo can tell you about tho

2026-01-27T22:19:10.289809Z

yeah it'll warn you. (but again, I just never do it. it's easy to avoid.)

2026-01-27T22:23:40.370059Z

☝️ yeah if I already have a thing named e.g. :client/name I do the same

2026-01-27T22:28:00.879119Z

yeah that's my take. if you're destructuring, you already have a great name—esp if it's a namespaced key. I rely on that and use very short symbols for locals.

wevrem 2026-01-27T23:26:32.955079Z

My current approach is a verbose/redundant local name. My schemas are all :client/client-name or :client/client-key. Then when I destructure I end up with client-name and avoid shadowing.

Dave Liepmann 2026-01-28T05:58:16.866069Z

Some people don't mind shadowing but it drives me mad. Not worth the potential of stepping on a rake.

Dave Liepmann 2026-01-28T05:59:08.336219Z

A few years ago I noticed that some fellow shadow-haters keep a list of alternate terms: nom, kind, klass