Fork me on GitHub
#scittle
<
2023-11-27
>
alandipert19:11:15

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

borkdude19:11:44

@U04VC31U8 certainly possible

borkdude19:11:15

oh wait, with squint?

alandipert19:11:45

well, as an option, recognizing not full compat

alandipert19:11:16

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

borkdude19:11:22

yeah, #C03QZH5PG6M (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 #C03U8L2NXNC as compatible within reason the problem is the dependencies that are compiled along with scittle

alandipert19:11:16

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

borkdude19:11:18

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

borkdude19:11:18

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

alandipert19:11:34

Yep makes sense

borkdude19:11:42

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

borkdude19:11:51

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

alandipert19:11:22

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)

alandipert19:11:08

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)

borkdude19:11:23

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

alandipert19:11:55

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

borkdude19:11:39

hehe, probably not there yet though

alandipert19:11:35

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

borkdude19:11:46

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

alandipert19:11:58

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

borkdude19:11:09

I haven't been looking at WASM that much

alandipert19:11:48

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)

borkdude19:11:50

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

borkdude19:11:57

Is that still a thing?

alandipert19:11:15

It still exists, yes 😄

alandipert19:11:24

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

alandipert19:11:06

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

alandipert19:11:58

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

borkdude19:11:12

yeah that's pretty cool

alandipert19:11:14

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

borkdude19:11:49

where did you see this?

borkdude19:11:35

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

alandipert19:11:39

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

borkdude19:11:56

yes, you could theoretically do this

borkdude19:11:27

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

alandipert19:11:52

ok cool, makes sense, thanks

alandipert19:11:32

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

borkdude19:11:34

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

borkdude19:11:45

yeah could also work

alandipert19:11:59

So many things