Fork me on GitHub
#babashka
<
2022-08-01
>
borkdude09:08:18

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
jjttjj17:08:05

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)

borkdude17:08:15

What does Clojure do here?

jjttjj17:08:15

Clojure lets you shadow the current namespace with an alias

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

(x/pprint "hello")

borkdude17:08:41

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

jjttjj17:08:46

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