Welcome! Please see the About page for a little more info on how this works.

+4 votes
in ClojureScript by
edited by

Native support for BigInt in JavaScript has been around since 2020. (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt)

Any chance of support for this in ClojureScript any time soon?

Would be nice to be able to use this as a number in numeric ops and as a key in hash maps.
Also, cljs.core could be extended with functions like bigint and integer? from clojure.core.

BigInts would bring clojurescript one step closer to supporting Ratios.

1 Answer

+2 votes

Supporting them as keys in hash maps should be fairly straightforward. Supporting them in numeric ops is more challenging as big integers and JavaScript double values cannot be used together which is a big departure from Clojure's numeric tower. Some experimental work has been done to assess but it will take more thought.

Thanks for answering.
Take this as an "upvote" for prioritizing more thought on BigInts in ClojureScript then :D