integrant

Ahmed Hassan 2025-10-01T16:25:40.799589Z

;; Following works with composite key.
(defmethod ig/init-key ::sugared-greet [_ {:keys [name]}]
  (println "Hi" name))

;; Following doesn't work with composite key.
(defn sugared-greet [{:keys [name]}]
  (println "Hi" name))

(def config
  {[::sugared-greet ::a] {:name "Alice"}})

(ig/init config)
While trying to use normal function in composite key, I found that it doesn't work, but ig/init-key variant works. Is it expectation or bug? Ref: https://github.com/weavejester/integrant?tab=readme-ov-file#initializer-functions

weavejester 2025-10-01T16:54:26.895599Z

It's a bug, or rather something I didn't think of when I wrote the syntax sugar. It should be easy enough to fix though - we check if the key's a vector, and if so we iterate through and check each keyword within it.

👍 1
weavejester 2025-10-02T01:10:51.559219Z

Open an issue for it on the Integrant repo and I'll get it fixed.

👍 1
Ahmed Hassan 2025-10-02T02:08:40.961869Z

https://github.com/weavejester/integrant/issues/114