Did some testing and Squint is about 112kb compiled for the browser whereas Scittle is 184kb. ๐ค
What do you mean โin the browserโ? It depends what kinds of dependencies you use. Squint itself is small
I mean the ability to dynamically run cljs-like code, similar to what Scittle does. The Squint core is small but to parse cljs-like requires the full compiler. Is that right?
you mean with the evaluate stuff. yes, the compiler is written in CLJS so it pulls in a lot of stuff
Hm I wonder if it would compile with :lite ๐ค
compile what? it's already JS
sorry wrong thread
Lite is really limited, I don't think it'll work
The size actually went up. ๐
TIL: Squint's datastructure manipulation primitives compile out to about 1kb and if you include atoms and atom manipulation fns it's 3kb. So with that it's possible to bundle-out cljs-like datastructure functions into a separate library that can be use from JS to do things like assoc_in on native JS datastructures. I got to thinking about this when building very small JS based frontends with van.js and I don't like the data model that LLMs default to. It would be far better if I could have a top level single-source-of-truth datastructure and do cljs-style manipulation on it. I wonder if this would be useful/interesting to anybody else or am I off chasing butterflies again?
Implementation is trivial:
export {
get,
get_in,
nth,
peek,
contains_QMARK_,
assoc,
assoc_BANG_,
assoc_in,
update,
update_in,
conj,
conj_BANG_,
merge,
merge_with,
into,
dissoc,
dissoc_BANG_,
pop,
select_keys,
empty,
atom,
deref,
reset_BANG_,
swap_BANG_,
add_watch,
remove_watch
} from './src/squint/core.js';
Build it like this:
npx esbuild squint-ds.js --bundle --minify --format=esm --outfile=squint-ds.min.jsThis is something I have personally needed when working on JS codebases. I wonder if there is any interest on having this squint-ds.min.js artifact built and available on e.g. npm and CDNs? I could put together a PR against the squint repo if that sounds like a good idea.
Why not use squint core directly ?
I'm thinking of the no-build use-case.
you can use squint core without a build? it's just a lib
That's true.
Having another lib re-export functions that already exist in the other lib should tell you this?
I guess the idea of having access to assoc etc. in a 1kb file excites me more than having it in a 61kb file.
oh right, you want minified
I missed that
I think that's reasonable since we also already have a umd build