Fork me on GitHub
#babashka
<
2021-07-26
>
cfleming03:07:01

In Clojure, I get:

user=> (meta #'*ns*)
{:added "1.0", :ns #object[clojure.lang.Namespace 0x18fdb6cf "clojure.core"], :name *ns*, :tag clojure.lang.Namespace, :doc "A clojure.lang.Namespace object representing the current namespace."}
However, in bb for a bunch of vars (`#'global-hierarchy` #'*ns* #'*print-meta* #'*out* #'alength #'*math-context* #'*command-line-args* #'*err* #'*print-level* #'*in* #'*print-length* #'*print-namespace-maps* #'*warn-on-reflection* #'*data-readers* #'*file* #'clojure.core/unquote) I get:
user=> (meta #'*ns*)
{:dynamic true}
In particular, I’m interested in the fact that those vars don’t seem to have a namespace. Is that expected? Is it a reasonable assumption that if a var doesn’t have a namespace then I should consider its namespace to be clojure.core? They all are in Clojure.

borkdude07:07:22

@cfleming This is a bit of an historic mess: in the very beginning bb didn't even have namespaces and ever since they are optional as metadata. But this can be straightened out.

borkdude08:07:08

I'll try to fix it for the next release

borkdude08:07:50

The entire list can be found with: (clojure.pprint/pprint (for [ns (all-ns), [k v] (ns-publics ns) :when (not (:ns (meta v)))] [(str ns) k]))

borkdude20:07:21

@cfleming only 230 vars to go... I'll get there ;)

cfleming23:07:29

Hehe, ok, no problem - for the moment, I’m just defaulting to clojure.core if there’s no ns, which is correct for all the ones I’ve found so far except global-hierarchy, which doesn’t exist in Clojure.

cfleming23:07:35

Actually, sorry, I hadn’t fully grokked your message above - I see. I’ll see if I can work around that.