I see this is a WIP without support for the Scheme numerical tower, tail calls, continuations, etc. If you're looking for such features, Gambit Scheme can compile to JS with those features working and comes at ~600kb gzipped (for the _whole_ system). You can see it in action at https://try.gambitscheme.org but I don't know if it's the latest version.
Yep, basically. I looked into Racketscript a while ago, seems like it was a graduate thesis project that heavily built off of a similar python project iirc. It's based on a very old version of rkt, pre-chez, and probably would need a huge investment just to work with the newer ecosystem.
Iirc, an interesting bullet-point in their backend rework to make the move to chez meant that doing things like targeting js might be easier now than ever. I would absolutely love a js backend for rkt, it seems like it would be a huge boon to the ecosystem.
The transition to the Chez Scheme back end is almost bug compatible [1], so if it worked in the old version, it should work in the new one.
One advantage or migrating it to the Chez Scheme version is that some tricky functions (like print or display that have like a million of corner cases) are implemented in Racket or in Chez Scheme, so it's not necessary to write them again in JavaScript.
[1] For example in the old version, only the small chars were interned and in the new version all are interned, so code like (eq? #\λ (integer->char (char->integer #\λ))) may have a different result. It's true in the new version, but in the old version it may be false if the optimizer is not aggressive enough with the constant folding.
Sadly "I didn't know Gambit could do X" seems to be a frequent sentiment considering the project's documentation. The configure script hints at many a feature that isn't described anywhere.
Gambit has some syntax to call functions in the host language (C/Python/Ruby/etc). That syntax is what is used to call Javascript functions that exist in the context where the compiled script is executed (window/node). As far as using stuff like ES6 style imports and the like, there is a project on Github called gambscript but it isn't complete as far as I can see. Someone out there can get closer but I know it isn't me.
Implementing the numerical tower is not too difficult. There may be some problems to ensure fixnums are singletons and bignums are efficient, but it looks possible.
Tail calls and continuations are more difficult if you want them to be efficient.
For some folks who'd like me to trust their web knowledge, having an expired certificate certainly doesn't give me any more trust than I already had.
More on topic: I wonder how the REPL story is with Racketscript? Nothing seems to be mentioned in the README nor in the repository which would make this project a non-starter for the people who got used to ClojureScript and similar efforts.
That is a bummer about the expired certificate. You can access the site using http instead of https if you are comfortable doing so. I have never seen this live REPL before and have just used their Github repo to get the latest: https://github.com/gambit/gambit
I think it is great someone is trying to get Racket compiling to Javascript again. I also agree with you about the REPL; while it is interesting to compile Racket to JS, having a REPL, a live environment and all the features of something like ClojureScript has much more utility.
Sorry about the certificate... I hadn't noticed it had expired. That is fixed now and you can visit https://try.gambitscheme.org/ to try it out (don't type anything in the REPL and you will get an automatic demo).
The last part of the demo shows how to use threads in the browser and also the JavaScript FFI. The FFI based on an infix syntax is explained in greater detail in this ELS'21 paper: http://www.iro.umontreal.ca/~feeley/papers/BelangerFeeleyELS... . The paper contains several examples. Here's a simple one you can type at the REPL:
Basically a backslash switches to JavaScript (with infix syntax) and a backquote switches back to Scheme (with prefix syntax).
The whole Gambit system fits in a 640KB gzipped JavaScript file, so it is reasonably fast to load.
If you are interested in a really tiny Scheme implementation in JavaScript that supports tail-calls and call/cc and an incremental Scheme compiler and a REPL and most of the R4RS procedures, you might want to try out the Ribbit Scheme implementation which is just under 6 KB of (non-gzipped) JavaScript: https://udem-dlteam.github.io/ribbit/repl-max.html . That implementation is described in a paper at the VMIL'21 workshop (presentation on October 19).