scittle

2023-11-27T19:14:15.672609Z

just realized it might not be hard to dump a scittle image as JS via squint, maybe with tree shaking, all in the browser

borkdude 2023-11-27T19:15:44.084759Z

@alandipert certainly possible

borkdude 2023-11-27T19:16:15.138909Z

oh wait, with squint?

2023-11-27T19:16:45.749399Z

well, as an option, recognizing not full compat

2023-11-27T19:18:16.590119Z

I guess bootstrapped cljs would be better, if that's still a thing

borkdude 2023-11-27T19:18:22.646649Z

yeah, #cherry (same as squint but uses the CLJS stdlib) has more chances of being compatible with CLJS code as is, although I'm trying hard to make #squint as compatible within reason the problem is the dependencies that are compiled along with scittle

2023-11-27T19:19:16.414169Z

Those are already js though right? So at a minimum they could be prepended

borkdude 2023-11-27T19:19:18.720419Z

but one could make a similar thing as scittle but with cherry and then the idea would 100% work https://github.com/squint-cljs/cherry/blob/main/doc/embed.md

2023-11-27T19:20:02.007289Z

Thx

borkdude 2023-11-27T19:20:18.218719Z

true, but those deps are optimized for scittle, you can't just mix and match modules that were advanced compiled

2023-11-27T19:20:34.721979Z

Yep makes sense

borkdude 2023-11-27T19:21:42.946519Z

you can "eject" a single js file just from scittle stuff only as well. it's just less optimal, but it still works

borkdude 2023-11-27T19:21:51.979259Z

I've done a similar thing for #nbb which is SCI based]

borkdude 2023-11-27T19:22:09.581409Z

https://github.com/babashka/nbb/tree/main/doc/bundle

2023-11-27T19:22:22.208129Z

Zooming out the vision here that I've had in mind for a few years is a maximally flexible but slow/big lisp environment ...but that lets you build up an image Which you can layer optimization and delivery stuff onto, in the target environment (browser)

2023-11-27T19:24:08.997179Z

In retrospect I feel gclosure advanced and things like it are in opposition to the vision (impose closed world requirements earlier than necessary, produce object files that can't be linked easily)

borkdude 2023-11-27T19:25:23.874529Z

yep. cherry and squint are open world with a shared stdlib (clojure.core if you will) such that you can actually share your libraries on npm with others. advanced compilation only happens in applications, never with libs

2023-11-27T19:25:55.907039Z

Glad you've been building it all while I've just been thinking about it 😄

borkdude 2023-11-27T19:26:39.738309Z

hehe, probably not there yet though

2023-11-27T19:27:35.049069Z

What are your thoughts on wasm (+ GC extensions) subsuming this all in relative near future?

borkdude 2023-11-27T19:27:46.169509Z

take this example, a pinball game in squint: https://squint-cljs.github.io/squint/?src=https://gist.githubusercontent.com/borkdude/ca3af924dc2526f00361f28dcf5d0bfb/raw/09cd9e17bf0d6fa3655d0e7cbf2c878e19cb894f/pinball.cljs You can see the generated JS in the right pane. It wouldn't be hard to produce a single .js file from this and take it with you elsewhere

2023-11-27T19:27:58.730499Z

I guess in that world sci would just run wasm and you could keep the scittle API?

borkdude 2023-11-27T19:28:09.669409Z

I haven't been looking at WASM that much

2023-11-27T19:30:48.807499Z

Fair enough. I have only because it's the end run on browser Common Lisps. Better fit for them because CL only runs standard with things JS can't do efficiently (jumps, ints)

borkdude 2023-11-27T19:31:50.620689Z

I remember that you presented something at EuroLisp (or what was the title of the conf) about a Common Lisp in the browser, right?

borkdude 2023-11-27T19:31:57.432919Z

Is that still a thing?

2023-11-27T19:32:15.331769Z

It still exists, yes 😄

2023-11-27T19:33:24.938479Z

I went with a compiler first tho and it wasn't snappy enough to give me the scittl-like dev setup I wanted, so I lost some steam

2023-11-27T19:34:06.746179Z

But my favorite CL (ECL) now runs via emscripten in wasm, so I might be able to get away with just driving that via script tags

2023-11-27T19:34:58.339549Z

They're also working on a compiler overhaul to support wasm target. So I'm enthusiastic anew about browser CL prospects

borkdude 2023-11-27T19:35:12.460819Z

yeah that's pretty cool

2023-11-27T19:47:14.609429Z

Just saw about scittle "eject", sounds like that dumps deps + scripts + interpreter?

borkdude 2023-11-27T19:47:49.572219Z

where did you see this?

borkdude 2023-11-27T19:48:35.521719Z

AFAIK I haven't made it yet but yes, that's how I would do it currently (nbb bundle does the same thing)

2023-11-27T19:48:39.975479Z

Above, "you can "eject" a single js file just from scittle stuff only as well. it's just less optimal, but it still works" perhaps I misunderstood

borkdude 2023-11-27T19:48:56.406069Z

yes, you could theoretically do this

borkdude 2023-11-27T19:49:27.638729Z

append the modules you're using + your script(s) in some string variables and then call scittle.core.eval_string on those in order

2023-11-27T19:49:52.602079Z

ok cool, makes sense, thanks

2023-11-27T19:50:32.790309Z

I guess you could put all that in the html and "download webpage" could work

borkdude 2023-11-27T19:50:34.768719Z

I guess you could also come up with a different "eject" which creates a zip file for you with a proper CLJS project

borkdude 2023-11-27T19:50:45.145979Z

yeah could also work

2023-11-27T19:50:59.431019Z

So many things ✨