clojure-dev

Kirill Chernyshov 2025-12-04T11:43:33.250419Z

I'm not sure if it is a bug or feature (imho it is a bug) but currently clojure allow leading zeros ending up reading such number as octal representation. The problem is that it is also allowed to have indefinite amount of leading zeros for octals:

000000000000042  ;; => 34
and when there is a suffix "M" that forces floating point representation the same string become float 42 stripping all leading zeros.
000000000000042M ;; => 42M
At the same time EDN specification forbids integers with leading zeros at all even for floats. I found a ticket about leading zeros in data.json but I think it should be expanded to cover clojure as well.

Kirill Chernyshov 2025-12-04T11:47:35.810109Z

in the same scope but because of the EDN spec: float specification allows leading zeroes in exponent and only zeros in fractional parts:

0.00000000...00
0.0e0001
probably because of that clojure is also read such numbers without error.

Alex Miller (Clojure team) 2025-12-04T13:20:29.657449Z

Please put it on Ask Clojure and I’ll make a jira for it

Kirill Chernyshov 2025-12-04T13:31:31.755729Z

https://ask.clojure.org/index.php/14798/leading-zeros-in-numbers done

1
Jianling Zhong 2025-12-17T21:59:11.069329Z

this is because jank follows clj 😂

jeaye 2025-12-15T06:46:46.473429Z

jank does exactly the same thing. 😂 Good find!

1