Fork me on GitHub

Wow, I haven't looked at Clojure build matrix results on in a long time. So many JDKs.

Alex Miller (Clojure team)19:09:19

within the last 6 months I’ve almost completely swapped out the old set (with Oracle 8 maybe the only common one between old and new)


I do not miss IBM JDK 1.6

Alex Miller (Clojure team)19:09:27

heh, me neither. but in the brave new open jdk world we might have a whole bloom of variants

Alex Miller (Clojure team)19:09:39

not looking forward to that much


There are also the new Graal VMs that are similar but different


Community and enterprise variants to boot


In which @mfikes writes “while also dealing with the trick that vec and set employ when using with-meta to force a new object to be created”


This brings up two questions wrt Clojure


1) The doc-string for set does not specify that a new set is created, although seems to indicate that a new set should be created.


2) With, calling set on a set does no longer create a new set, since the (with-meta coll nil) trickery doesn’t return a new set, unless the original set has meta-data


3) which also breaks the doc string for vec, which clearly states that it returns a new vector:


Clojure 1.10.0-alpha8
user=> (let [v [1 2]] (identical? (vec v) v))

Alex Miller (Clojure team)20:09:41

1) the “new set” there is specifically about the case where there is meta returning a set with no meta. it doesn’t say that a set with no meta needs to return a new instance

Alex Miller (Clojure team)20:09:21

stepping back, what is the interesting case where behavior has changed?

Alex Miller (Clojure team)20:09:59

with persistent colls, there are great advantages to reusing identical instances when possible

Alex Miller (Clojure team)20:09:59

one of the few cases where set/vec return an observably different instance is in the case of meta, and while I think that use case was more accidental than intentional, it’s been preserved


I guess this started as a question of “why is the doc-string for set and vec different wrt returning a new object?”


which all ended up in 3) where the docstring for vec is no longer correct.

Alex Miller (Clojure team)20:09:18

my guess would be that they were not intended to be meaningfully different

Alex Miller (Clojure team)20:09:44

and unless there is some really good reason, I’d be more inclined to adjust the doc string to clarify than the code


I’d be happy with the latter as that would make the patch for CLJS-2794 smaller.


I like thinking of set and vec as coercion fns; it would be nice if they act as the identity function when they can

Alex Miller (Clojure team)21:09:48

just fyi, I am soon slipping over the Strange Loop event horizon and will re-emerge in some future dimension (aka next week)


See you on the flip side. 🙂


Have great conf, Alex!


... Alex returns to find several of us have reported him missing ...