datomic 2025-09-16

perhaps a long shot 😊 has anyone with macro chops perhaps come up with a way to inline Clojure functions into inputs for Datomic's d/function? i've been using letfn as my topmost form and copying over otherwise normal functions (with no dependencies other than core and datomic) into there, but it's quickly getting stale πŸ˜… there are so many great Datomic library and tool repos out there these days. does this ring a bell for anyone?

Great question. Classpath functions are underutilized and don't make you transact all the pieces into the database

βž• 1

They can call helpers directly, structure your code however you want.

Downside: you have to ship code to your transactor classpath then cycle your transactor

I think the superior developer ergonomics of classpath functions generally outweigh the additional deployment complications, especially as you start using transactor functions more heavily.

yep that downside is a real impediment for us. we'd have to cycle our transactor every time we deploy, which is often.

i guess we'd have to push through on building and shipping a jar suitable for this use, and then setting up a CI pipeline that conditionally builds it whenever its sources change.

we’ve done that and it’s been worth it

we have a single file that contains our classpath functions, compute the hash of that file on deploy and only restart the transactor it if it changed.

πŸ™ 1

we considered having a defn alternative that records the form but decided against it. Utility fns then also need to be called through datomic.api/invoke which we found too cumbersome.

βž• 1

> we'd have to cycle our transactor every time we deploy, which is often. is your transaction supporting code really moving that fast?

thanks @ghadi, it's more that our current CI happens a lot, so we'd have to build conditional deployments into that as described above. it's all good though, i completely buy that it's worth the once-off effort of getting CI right to be able to program normally with Clojure in this mode πŸ™‚