clojurescript 2025-11-23

Very inspired by @dnolen's conj talk, especially this slide:

This is incredible stuff by the way - would love figure out how to get this into low barrier community effort we can link to from the main CLJS website - cc @neumann @alexmiller ^

Thanks, David; those are kind words. I verily appreciate the nudge you gave me to look deeper into GCL, and I'm actively forming many more thoughts as I continue to explore.

You're not the only one @hhausman ๐Ÿ™‚

๐Ÿ™‡ 1
1

@dnolen I'm interested. Now that we're past the Conj, I'm hoping to finally get some time to work on content and the websites.

@hhausman Nice examples! What did you use to build that static site?

Thanks - I actually used some of our closed-source stuff to do it, and it's not really for doing this kind of thing. Though, it did save time. Speaking generally, one can imagine how such a thing is accomplished (code is data!). simple_smile In @dnolen's conj talk there was also a more direct call-to-action for us to own the GCL api docs on the Clojure GCL fork, and that makes a lot of sense to me. I am not a JSDoc expert, but I would like to help with that effort.

I was just looking at this...

harold@straylight:~/src/closure-library [master]$ cloc .
    2270 text files.
    2201 unique files.                                          
     200 files ignored.

github.com/AlDanial/cloc v 2.04  T=1.49 s (1481.9 files/s, 570220.8 lines/s)
-------------------------------------------------------------------------------
Language                     files          blank        comment           code
-------------------------------------------------------------------------------
JavaScript                    1629          86182         187859         523162
HTML                           347           2910           1950          22466
Bazel                          115           1169              3          10878
CSS                             62            762            907           3378
JSON                             7              0              0           1394
TypeScript                       5             94            339            853
Markdown                         9            207             17            520
Text                             2             77              0            351
Python                           6            205            325            274
Bourne Shell                     8             45            157            122
YAML                             5             15             43            109
SVG                              3              7             29             25
Lisp                             2             15             31             24
Starlark                         1              3              3              7
-------------------------------------------------------------------------------
SUM:                          2201          91691         191663         563563
-------------------------------------------------------------------------------

500k lines of js is mental.

Woah! That's huge!

again this is why I think some kinda of low barrier here would be good, community can contribute stuff as they discover it

๐Ÿ‘ 1

I have some data in clj side that I want to pass as initial state into an HTML page. I am using hiccup. So I am thinking I should emit this as EDN string into a script like :

const init_data = "edn data";
and then read it with cljs.tools.reader.edn when the cljs part starts on page load. Is this correct? Is there some special escaping I should be doing?

you can just use cljs.reader and the approach (or actual library) described here: https://code.thheller.com/blog/shadow-cljs/2023/07/16/applying-the-art-of-cljs-frontend.html

these two posts describe the idea in general

@roklenarcic if you use JSON you can save on some bytes in the front-end, if you're not using clojure.edn or clojure.reader (same thing in CLJS) in another place

well, some of the things in this data structure are ratios

Does CLJS support ratios?

I will have to do some coding there

using tags or something

I am trying to combine shadow/graft with uix SSR React and I am struggling to include grafts into my react tree

graft isn't meant for react ssr, so thats not gonna work

Is there something like https://github.com/gfredericks/exact for ratios, but newer than 7 years?

> newer than 7 years Why should that be a factor at all?

because it no longer works

I can fix it though

but I was wondering if there was something newer perhaps with some kind of reader tag code as well

Oh, that's interesting. What's broken in that library?

later clojure version added abs to clojure.core and this library overrides that function which makes it not compile

Huh, I think that should only be a warning?

not how it works for me

(require '[com.gfredericks.exact :as e])
------ WARNING - :redef --------------------------------------------------------
 Resource: <eval>:130:1
 abs already refers to: cljs.core/abs being replaced by: com.gfredericks.exact/abs
--------------------------------------------------------------------------------

Funny that CLjS can break existing code by adding core functions. Or is it shadow

and then any reference to that namespace fails

even though it says warning here

I think that warrants an issue in CLJS

e/ZERO

Execution error (TypeError) at (<cljs repl>:1).
Cannot read properties of undefined (reading 'exact')

But you can easily fix this by using :refer-clojjre

yeah, in that library

not my code

hereโ€™s a fork that does exactly that https://github.com/jkxyz/exact

I can just use deps to require this commit directly

instead of using maven coordinates

Vanilla CLJS:

$ clj -Sdeps '{:deps {com.gfredericks/exact {:mvn/version "0.1.11"}}}' -M:cljs-repl
ClojureScript 1.12.42
cljs.user=> (require '[com.gfredericks.exact :as e])
WARNING: abs already refers to: cljs.core/abs being replaced by: com.gfredericks.exact/abs at line 130 /home/p-himik/.cljs/.aot_cache/1.12.42/8252586/com/gfredericks/exact.cljc
nil
cljs.user=> e/ZERO
#object[Object 0]
So probably a shadow-cljs issue, pinging @thheller just in case.

Has anyone considered making a PR to @gfredericks lib? I know from experience that he still responds to issues

confirming it should be warning only

warning yes, but the default is to not load code with warnings, although that is meant to apply for code from libraries. hot-reload also just loads those. guess I could make that smarter.