clojure-dev

Issues: https://clojure.atlassian.net/browse/CLJ | Guide: https://insideclojure.org/2015/05/01/contributing-clojure/
2020-09-14T16:49:44.040600Z

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.

2020-09-14T16:50:25.040700Z

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

2020-09-14T16:51:39.041Z

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

2020-09-14T16:52:58.041200Z

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.

2020-09-14T16:56:12.041400Z

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.

alexmiller 2020-09-14T17:09:35.041600Z

dunno, feel free to file a jira