Fork me on GitHub
#cljs-dev
<
2019-02-27
>
Yehonathan Sharvit07:02:50

@dnolen I love so much Clojurescript (and my customer also) that we are not angry at all about this breaking change. We understand retroactively that we made a bas usage of key and val on vectors. Indeed, we shouldn’t. But the fact is that we did! I also see in https://github.com/clojure/clojurescript/blob/master/changes.md that Cljs 1.10.238 contains this change > Map entries are no longer two element vectors, now MapEntry instances But from here it’s not really clear that my key and val usages are going to be broken A little warning about that would have been very helpful

thheller07:02:15

@viebel it is pretty much impossible to predict all possible scenarios in which a change may break code. It was simply not expected to use key or val on sequences so warning about something we don't know people are using in the first place is kinda hard.

Yehonathan Sharvit10:02:47

I see @thheller By the way, it also breaks om as in om MapCursor implements of ISeq by returning a seq of 2 elements vectors https://github.com/omcljs/om/blob/master/src/main/om/core.cljs#L625-L628 Therefore (vals map-cursor) used to work previous cljs 1.10 and not on anymore cljs 1.10

dnolen16:02:55

should fix that, but also demonstrates why this behavior was really undesirable in the first place

Yehonathan Sharvit07:02:46

What behaviour was undesirable in the first place? (and why is it undesirable?)

Yehonathan Sharvit18:02:53

@dnolen What behaviour was undesirable in the first place? and why is it undesirable?

dnolen18:02:13

because some Clojure code relies on MapEntry, walking data structures etc.

dnolen18:02:25

it's impossible if you don't know if you have a real MapEntry or not

dnolen18:02:56

so walking didn't work in ClojureScript

dnolen18:02:28

until the above changes were made and consistently

Yehonathan Sharvit20:02:08

Do you want a patch for om ?

Yehonathan Sharvit20:02:55

Wrapping the current code with (into {}…) Something like that:

ISeqable
  (-seq [this]
    (when (pos? (count value))
      (seq (into {} (map (fn [[k v]] [k (-derive this v state (conj path k))]) value)))))

Yehonathan Sharvit20:02:19

At audyx, we still use om!

chancerussell17:02:36

Just to be clear, this doesn’t have any implications on destructuring a MapEntry, right?

chancerussell17:02:15

(map (fn [[k v]] [k (f v)]) my-map) etc etc

chancerussell17:02:08

In other words, MapEntry still behaves as a vec, but vecs stop behaving as MapEntries

chancerussell17:02:16

Yep. I guess I’m more asking if it’s still “philosophically cool” 😛