This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-01-28
Channels
- # announcements (4)
- # aws (2)
- # babashka (56)
- # beginners (43)
- # calva (70)
- # clj-kondo (25)
- # cljs-dev (29)
- # clojure (103)
- # clojure-dev (9)
- # clojure-europe (55)
- # clojure-gamedev (8)
- # clojure-nl (5)
- # clojure-norway (5)
- # clojure-uk (4)
- # clojured (1)
- # clojurescript (56)
- # copenhagen-clojurians (1)
- # core-async (2)
- # cursive (16)
- # datomic (5)
- # deps-new (18)
- # emacs (9)
- # events (3)
- # fulcro (45)
- # graphql (2)
- # gratitude (2)
- # kaocha (6)
- # lambdaisland (8)
- # lsp (72)
- # meander (41)
- # missionary (5)
- # nextjournal (52)
- # off-topic (2)
- # pathom (12)
- # pedestal (2)
- # practicalli (1)
- # re-frame (6)
- # reitit (5)
- # releases (1)
- # reveal (1)
- # specter (3)
- # sql (4)
- # tools-deps (22)
- # vim (8)
- # wasm (1)
- # xtdb (22)
Working on incorporating Alex’s tests, I’m noticing the new functions in Clojure 1.11.
I see that CLJS-3331 (add update-vals
and update-keys
) addressed 2 of the functions, but I can’t see any of the other functions mentioned. Should I go ahead and add a ticket for them? Happy to implement if no one else has done it
The functions are: parse-long
, parse-double
, parse-uuid
, parse-boolean
, NaN?
, and infinite?
please carefully match the semantics in the Clojure functions for valid string / invalid string / non-string
For the parse fns
The results in those partitions are parsed value / nil / exception respectively
I’ve put up a new patch on https://clojure.atlassian.net/browse/CLJS-3347:
• removed the autogenerated version number
• Incorporated Clojure tests
• Renamed a function that was renamed in Clojure between alpha3 and alpha4 (`clojure.java.math/negative-exact` -> clojure.math/negate-exact
)
Added https://clojure.atlassian.net/browse/CLJS-3348 to introduce the new functions I mentioned last night
@quoll branch with patch applied here - https://github.com/clojure/clojurescript/pull/124/
I still have an old AppVeyer setup running and a couple tests failed there: https://ci.appveyor.com/project/mfikes/clojurescript/builds/42411989
Almost all of these seem to be based on the distinction between -0
and 0
being lost.
One stood out for me on lines 76-78:
FAIL in (test-pow) ([object Object]:170:7)
expected: (= ##-Inf (m/pow 0 -3))
actual: (not (= ##-Inf ##Inf))
That’s strange, because Math.pow(0, -3)
is positive infinity (that’s the same in both Java and JavaScript). So I looked at the original code:
(is (= ##-Inf (m/pow -0.0 -3.0)))
So the code being executed appears to be different to the original source. This suggests to me that the code being sent to the self-hosted compiler has been read and converted back into a string, and that leads to the -0
values losing their sign. Is that a thing that happens Mike?There are probably symbols not intended to be public, like MAX-FLOAT-VALUE
(see https://gist.github.com/mfikes/eec91b7aab55c093ca9bcb2f892633aa) (I suspect dir
on the Clojure and ClojureScript versions of this namespace would produce the same list of public names in the end)
Ahh, so @quoll in JVM ClojureScript, the reader is implemented in Clojure and evidently it can read -0.0
, but the self-hosted reader doesn't handle the numeric literal -0.0
in that way...
These are important constants to have access to. I need them internally, and because anyone in Clojure land can refer to these values I made them available for ClojureScript too… but with different names
JVM ClojureScript:
cljs.user=> (/ -0.0)
##-Inf
Self-hosted ClojureScript (Planck):
cljs.user=> (/ -0.0)
##Inf
Nope… I made a mistake. They’re already in JavaScript. I should reuse those values and not redefine them. I’ll fix that now
Given that JavaScript reads these numbers and represents them internally correctly, then it would seem so?
(Meaning a potential bug in https://github.com/clojure/tools.reader)
Turns out the problem is not with the self-hosted reader, but at the other end (emission). Fix in https://clojure.atlassian.net/jira/software/c/projects/CLJS/issues/CLJS-3352
Cool, putting it all together with Paula's 2nd patch passes: https://github.com/clojure/clojurescript/commits/cljs-math-test-2

I’ve added what I hope is the final path to https://clojure.atlassian.net/browse/CLJS-3347 This includes the tests on self-hosted since that now passes