This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-09-14
Channels
- # babashka (18)
- # beginners (92)
- # calva (11)
- # cljs-dev (2)
- # clojure (37)
- # clojure-berlin (6)
- # clojure-czech (2)
- # clojure-dev (6)
- # clojure-europe (50)
- # clojure-france (15)
- # clojure-nl (4)
- # clojure-spec (1)
- # clojure-uk (18)
- # clojurescript (29)
- # cursive (31)
- # data-science (1)
- # datascript (2)
- # datomic (26)
- # depstar (55)
- # devcards (1)
- # duct (3)
- # emacs (49)
- # fulcro (29)
- # joker (3)
- # kaocha (1)
- # membrane (5)
- # midje (3)
- # music (2)
- # nrepl (4)
- # off-topic (3)
- # parinfer (13)
- # pathom (1)
- # portal (5)
- # re-frame (13)
- # ring (1)
- # schema (1)
- # sci (7)
- # shadow-cljs (25)
- # tools-deps (10)
- # vim (34)
- # vrac (2)
- # xtdb (20)
If this is considered a bug in Clojure's primitive vector implementation, it seems like perhaps a harmless one, but thought I would ask anyway in case I learn something new. See thread for details.
There is a print-method in gvec.clj with a dispatch value of ::Vec
, whereas I would have expected the dispatch value to be the class clojure.core.Vec
: https://github.com/clojure/clojure/blob/master/src/clj/clojure/gvec.clj#L455
It seems that this print-method is not called for Clojure primitive vectors, at least not normally:
user=> (= (get-method print-method [1 2 3])
(get-method print-method (vector-of :byte 1 2 3)))
true
Given the definition of the multimethod print-method
's dispatch function, it seems like that print-method
in gvec.clj would get called for any object that had metadata with a :type
key whose value was :clojure.core.Vec
, but I can't think of any reason why that would happen unless someone went out of their way to arrange it.
I suspect that this is intentional for reasons I haven't figured out, or it is a bug that no one has noticed because calling print-method
on a clojure.core.Vec
will already call the same method as for regular Clojure vectors, and that is what the print-method
definition in gvec.clj
appears to be trying to do, anyway, if it were used.
dunno, feel free to file a jira