Fork me on GitHub

If someone has quoting problems in cmd.exe or bash or whatever other shell, you can also launch a clojure from #babashka REPL:

user=> (babashka.tasks/clojure "-X clojure.core/prn" {:x "foo"})
{:x "foo"}

user=>  (babashka.tasks/clojure "-X clojure.core/prn" {:x 'foo})
{:x foo}

🆒 5
💪 2

I've noticed there are issues when aliasing another namespace that shadows the current namespace's name, and using a protocol. Not sure if this is a known thing, I could open an issue if you'd like.

(ns x
  #_(:require [clojure.pprint :as x])

;;; when the alias is used I get
;; Type:     clojure.lang.ExceptionInfo
;; Message:  Could not resolve symbol: x/IProto
;; Phase:    analysis

(defprotocol IProto
  (proto-method [this]))
(version v0.9.161)


What does Clojure do here?


Clojure lets you shadow the current namespace with an alias

(ns x
  (:require [clojure.pprint :as x]))

(x/pprint "hello")


I would say this should be a clj-kondo lint error and users should avoid this? ;)


fair enough! 🙂 the specific combination of bad ideas I was attempting is using awyeah-api aliased as aws in my own aws.clj namespace (single segment ns due to just being a demo thing) But yeah that probably shouldn't happen in real use