Gambit and other JavaScript Schemes Lassi Kortela 29 Dec 2020 12:10 UTC

On 29.12.2020 10.42, Jakub T. Jankiewicz wrote:
>> We should absolutely add Gambit's JS REPL to try.scheme.org!
> It looks nice, especially (read) that don't use browser built prompt, but use
> terminal. It's probably complicated to create, since default EMScripten
> behaviour is to use prompt because it stop the execution like c functions.
> I've created long ago issue[1] and a hack to add async execution, I'm not sure
> what the status of async code is right now.

I know about Emscripten but am clueless about the details. In what way
does Gambit use it? The file
<https://feeley.github.io/gambit-in-the-browser/gsi.js> (11 MiB) looks
like it houses the Gambit interpreter and also includes byte-compiled
versions of the bundled Scheme libraries. Is gsi.js itself generated by
Emscripten, or does it only include parts generated by Emscripten?

Does Emscripten's output look like a binary blob (byte array), or does
it look like transpiled code (semi-idiomatic JavaScript with
if-statements and functions and the like)?

Another file,
<https://udem-dlteam.github.io/webapp-tutorial/webapp-tutorial.js>,
starts with: "// File generated by Gambit v4.9.3" and contains code that
looks like the output of the Gambit transpiler. There is no mention of
Emscripten in the file.

The Chibi-Scheme and s7 interpreters (both written in C) have also been
compiled for use in a web browser, probably using Emscripten.

s7 is here: <https://actondev.github.io/s7-playground/>. Seems like the
main file is
<https://actondev.github.io/s7-playground/build/s7_wasm.wasm> which is
compiled WebAssembly, not JS.

We have reserved <https://web.scheme.org> for a site about web
development in Scheme. We could kick it off by adding a list of the
current JavaScript-capable Schemes, and some information about how they
work.

> If you want tutorial and terminal I think you will like how my new lips
> website look like[2] (it's kind of inspired byhttps://www.haskell.org/  that
> have links to examples that you can execute in terminal on click).

It's v

> I would prefer not to use more then one implementation if possible, it will
> probably be only for new users and it will confuse them. But maybe if it's
> hidden in menu it would be fine.

I agree that asking people to choose right away is confusing to newbies.
There should be some kind of menu, with a default interpreter that is
started automatically and a choice to switch to other interpreters.

If we have multiple interpreters, download size is also a concern. The
emscripten output tends to be over a megabyte; gsi.js is 11 MiB. How big
is Lips currently?

> Also one note Gambit in browser is not Open Source, it have Copyright but no
> license. So it can't be put on try.scheme.org. Also no source code is
> available, you would need to reverse engineer generated js code.

Gambit is all open source (many/most parts use Apache license). It would
make sense to have some comment about the license in the JS files.

There are no longer any closed-source Scheme implementations, now that
Chez Scheme is open source. Unless you count some old ones like
PC-Scheme for DOS :) Even that was open source for a long time.