Fork me on GitHub
#shadow-cljs
<
2023-07-10
>
borkdude16:07:59

I'm running into this issue again, I'm looking into repro-ing it, but not there yet https://github.com/thheller/shadow-cljs/issues/1063

borkdude19:07:58

It turns out to be a different problem.

(def infix-operators #{"+" "+=" "-" "-=" "/" "*" "%" "=" "==" "===" "<" ">" "<=" ">=" "!="
                       "<<" ">>" "<<<" ">>>" "!==" "&" "|" "&&" "||" "not=" "instanceof"})
(contains? infix-operators (name expr))
returns false for some symbol = but if I add a manual clause like:
(or (contains? infix-operators (name expr))
      (= "=" (name expr)))
it does return true. Does this ring a bell perhaps thheller? (I haven't pinged you, to not wake you up during your evening, but perhaps you'll see this tomorrow).

thheller20:07:22

no clue. given that this is all strings I don't see how munging plays a role here. don't know what expr is in this context. did you try printing infix-operators just to verify it is what you think it is? not sure how the above would construct something incorrect but I don't know which context you are doing all this in 😛

borkdude20:07:06

expr is a symbol = which is constructed by reading it from a string (source code)

borkdude20:07:28

I'll try printing tomorrow

borkdude20:07:19

I just tried it:

:infix-ops! #{">>" "&&" "!=" "=" "*" "%" "<=" "-=" "|" "/" "-" ">>>" "===" "not=" "!==" ">=" "&" "<" "<<" "+=" "instanceof" "<<<" "||" "==" "+" ">"}

borkdude20:07:58

I do notice that the hashes differ of those strings:

(prn :hash1 (hash (name expr)))
  (prn :hash2 (hash (name '=)))

:hash1 2042120020
:hash2 -516731966

borkdude20:07:56

oh no sorry, they are both the same, I was looking at the result of unequal symbols.

:hash1 = -516731966
:hash2 = -516731966

borkdude20:07:50

aaaah, I got it. sorry to bother you, I did somewhere:

(#?(:clj set-var!
    :cljs set!) cc/infix-operators (disj cc/infix-operators "="))
as a side-effect since in cherry equals should not translate to JS equals directly and this affected squint. facepalm

borkdude20:07:59

Thanks for the duckie