Tag: namespaces

  • You know when after a few months of dating someone, they do something that touches you and fall in love all over again. It just happened to me and Clojure. I was playing with Korma and I had the following namespace declaration:

    (ns carouselapps.db.core
      (:require
        [korma.core :refer :all]
        [korma.db :as db]
        [environ.core :refer [env]]
        [to-jdbc-uri.core :refer [to-jdbc-uri]]))

    which was generating this warning:

    WARNING: update already refers to: #'clojure.core/update in namespace:
                  carouselapps.db.core, being replaced by: #'korma.core/update

    What now? I thought I was going to spend the next two hours figuring out a clean way to deal with this, but nope, it took 5 minutes to figure out I could just rename korma.core/update  as I was requiring it:

    (ns carouselapps.db.core
      (:require
        [korma.core :refer :all :rename {update sql-update}]
        [korma.db :as db]
        [environ.core :refer [env]]
        [to-jdbc-uri.core :refer [to-jdbc-uri]]))

    This is the kind of real world pragmatism that you rarely see in programming languages, specially those rooted in academic practices, like being a Lisp, which Clojure is.

    I fell in love all over again. Sometimes it’s the small things you know!