Fork me on GitHub

how can i get the correct value of 4503599627370495 for cljs?

; cljs
(unsigned-bit-shift-right 9007199254740991 1)
; clj
(unsigned-bit-shift-right 9007199254740991 1)
(`9007199254740991` is the 2^53-1 max safe integer in js)


Perhaps if you use js/BigInt and plain bit-shift-right, because >>> is not supported for js/BigInt and because >>> clamps its operands to 32 bits.


(bit-shift-right (js/BigInt 9007199254740991) (js/BigInt 1))
#object[BigInt 4503599627370495]
@U2FRKM4TW it works, thanks 😉

👍 1
Matej Šarlija17:07:24

Hi, newb here, done some Javascript and Angular professionally, learned some Clojure for fun, what do you need to learn realistically to build Cljs apps (in addition to Clojure / Clojurescript 🙂 ) - mostly Reagent and Re-frame or?

Edward Ciafardini18:07:01

The 3rd edition of “web development with Clojure” will give you a good start


For re-frame, these read-to-go projects are a great leg up: Agreed on Helix as a path to RN without necessarily using reagent/re-frame:

Matej Šarlija16:07:23

Thank you all!

👍 1

@matejsarlija1 Post-newb here. My highly opinionated answer: you need and either reagent / re-frame or helix / keechma-next


hi, there's this comment in a clojurescript library but I don't understand why, is it because the macro is in some sense running "in clojure"? ;; we would like to just identify defui methods with metadata, ;; but since macros in clojure script won't have access to that metadata ;; we have to keep track elsewhere ;; this is the elsewhere


Macros are indeed run at the compile time.


And at the compile time, there's only CLJ, there's no CLJS (with the exception of bootstrapped CLJS).


and metadata somehow doesn't cross the boundary? because the metadata is attached in the 'cljs runtime' (??) or 'cljs namespace' and the clj-macro-compiler time has no access to that? if all the code is cljc-able then one could get around this by running everything through cljc imports so that the clj compile time will have access to the identical metadata? if that makes sense


like it's only a problem if one needs to do a cljs-only thing if that workaround works?


if the clj macros are doing a side effect like storing a load of state in an atom, that atom would be accessible in clj but not cljs, the macro needs some way to 'export' that atom to clojurescript? like clojure macros can fuck with runtime state but clojurescript macros naively can't?


(I'm the author of the referenced library). The metadata is only required at compile time. It's not needed at runtime. If I remember correctly, I think the issue is that the cljs compiler keeps some of the metadata (like :name ), but not all of the metadata. Specifically, the code uses :arglists . That was a while ago and it's possible the situation has changed since then.


I tried printing out meta data during compilation. It seems like all the bookkeeping could be done solely with meta data, but it's been a while since I wrote that code so there may be some other detail I'm forgetting.


interesting, I wasn't criticizing just trying to learn by asking about something I didn't understand


no offense taken!


that code is inherently tricky and supporting clj, cljs, bootstrapped cljs, native image, and sci (clj,cljs,native image) also makes it more tricky.