Fork me on GitHub

What was the recommended way of getting from var to symbol prior to this commit?

(symbol (str (-> the-var meta :ns ns-name)) (str (-> the-var meta :name)))


It would be nice if there was some interface or protocol that defines how to get from x to symbol maybe


is symbol an interface or protocol?

Alex Miller (Clojure team)19:11:46

it's an interface, for some generic interpretation of the word :)


I'm asking this because in sci (clojure interpreter) I have a custom var implementation but of course symbol doesn't work on that one.


if I could implement some ISymbol and symbol used that one, it would work


or IVar would be even more useful to me

Alex Miller (Clojure team)19:11:28

an interface method that coerced to symbol

Alex Miller (Clojure team)19:11:48

why does it need to be open vs closed


well, I would use it to make my custom var work well together with symbol. Right now symbol does a series of instance checks, which could then just be one ISymbol check perhaps

Alex Miller (Clojure team)19:11:37

why do you need a custom var?

Alex Miller (Clojure team)19:11:00

(I'm not trying to be combative, just trying to understand the root of the problem)


because there is no IVar standard that I can reference and sci (the Clojure interpreter) does not use clojure.lang.Var but stays away from that, as I consider that implementation detail

Alex Miller (Clojure team)19:11:42

also, you listed another implementor of this interface (custom var), but my question was, in what places would clojure use the interface rather than the concrete type?


in the symbol function


users of the clojure.core standard library?


I basically want to make this work in sci:

user=> (symbol #'inc)
But right now I would have to patch symbol because of its closed nature and add one instance check before it defers to clojure.core/symbol.


$ bb -e "(type #'inc)"

Alex Miller (Clojure team)19:11:54

I'm asking to be convinced that this is a problem broader than your use case :)

Alex Miller (Clojure team)19:11:38

I just honestly don't know

Alex Miller (Clojure team)19:11:49

fwiw, I think you could feel quite comfortable using clojure.lang.Var

Alex Miller (Clojure team)19:11:41

there are levels of "public" / "impl" in Clojure and I'd certainly consider the clojure core type impls to be more on the public/stable end of the dial


well, sci works on the JVM and in CLJS (JS). The var is implemented in .cljc so there is minimal difference between the two (or at least, the difference is very easy to see and reason about). Also clojure.lang.Var references clojure.lang.Namespace and possibly another chain of things I don't want to have in my interpreter, as this can cause problems with GraalVM possibly (bloat, or otherwise)


Maybe I could have used it and maybe it would have worked.


But I don't know what Clojure is going to do with Var in the future, so it seemed like a good idea to isolate this a bit


Right now I recommend to use :meta to get to the name of the var, but I was wondering how people did this before symbol supported clojure.lang.Var


I can just map a slight variation of symbol in sci that works with sci.impl.vars.Var, no problem actually. But it just got me wondering.


what's the proper channel to be confused on cider and nrepl problems in? I'm trying to figure out how to have two cider scratch buffers pointed to different nrepls in different projects in the same emacs


There is a #cider channel that sounds appropriate.