What was the recommended way of getting from var to symbol prior to this commit? https://github.com/clojure/clojure/commit/d29219f78e51da66daf1c66108ebebb97c68442f
(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
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: symbol
is symbol
an interface or protocol?
it's an interface, for some generic interpretation of the word :)
ha ha.
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
who would use that?
that = ?
an interface method that coerced to symbol
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
why do you need a custom var?
(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
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
but who uses that?
users of the clojure.core standard library?
There is a #cider channel that sounds appropriate.
I basically want to make this work in sci:
user=> (symbol #'inc)
clojure.core/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)"
sci.impl.vars.SciVar
I'm asking to be convinced that this is a problem broader than your use case :)
maybe not
I just honestly don't know
fwiw, I think you could feel quite comfortable using clojure.lang.Var
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.