metosin / malli

High-performance data-driven data specification library for Clojure/Script.
Eclipse Public License 2.0
1.43k stars 204 forks source link

Distinguish between symbols and strings in humanize #1031

Closed frenchy64 closed 2 months ago

frenchy64 commented 3 months ago

For clj use pr-str, for cljs use str.

ikitommi commented 2 months ago

Thanks!

danielcompton commented 1 month ago

@frenchy64 could you explain a bit more about why you made this change? Why can’t CLJ and CLJS both use pr-str?

We have CLJC tests which include Malli error messages. Now we need to use reader conditionals on the error message to have them pass in both CLJS and CLJ.

frenchy64 commented 1 month ago

I'm told pr-str in cljs is too expensive to use because it pulls in too much code after minification.

-------- Original Message -------- On 6/1/24 03:51, Daniel Compton wrote: @frenchy64 could you explain a bit more about why you made this change? Why can’t CLJ and CLJS both use pr-str? We have CLJC tests which include Malli error messages. Now we need to use reader conditionals on the error message to have them pass in both CLJS and CLJ. — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

liwp commented 9 hours ago

To close the loop here: we ended up overriding malli.error/-pr-str in our tests to get consistent output:

(t/use-fixtures
  :once
  (fn [f]
    (with-redefs [me/-pr-str pr-str]
      (f))))

A bit naughty, but keeps reader conditionals away from the tests.