Live data from Hacker News

Directly compiling Scheme to WebAssembly: lambdas, recursion, iteration

spritely.institute

11–20 of 24 posts

Re: Directly compiling Scheme to WebAssembly: lambdas, recursion, iteration

#12

All day I push out js for a paycheck, all night I live and tinker in my Lisp/scheme worlds. Maybe one day these will be overlayed.

Gambit has a JavaScript compilation target backend. It works really well. The runtime code you need to run JS-compiled Gambit code is large, but compared to the neutron-star density of most projects' node_modules it's utterly manageable. It's a little harder to justify on the front end though.

Re: Directly compiling Scheme to WebAssembly: lambdas, recursion, iteration

#13

Tangential question: How interoperable are the top Scheme implementations (Guile. Chez, Chicken, etc.)? Specifically, are libraries (beyond SRFIs) often supported in multiple implementations?

Bumping. Would be deeply interested too.

I did some search and didn't find any recent statement on that.

Re: Directly compiling Scheme to WebAssembly: lambdas, recursion, iteration

#14

Tangential question: How interoperable are the top Scheme implementations (Guile. Chez, Chicken, etc.)? Specifically, are libraries (beyond SRFIs) often supported in multiple implementations?

There are some that run on generic R[67]RS, but many libraries tend to target a specific implementation (chicken with its eggs, all the guile-whatever libraries). You can check out Akku (akkuscm.org) or Snow for Scheme-oriented package managers.

Re: Directly compiling Scheme to WebAssembly: lambdas, recursion, iteration

#15

All day I push out js for a paycheck, all night I live and tinker in my Lisp/scheme worlds. Maybe one day these will be overlayed.

ClojureScript? I hear it is a really great guest language that fits within its respective host ecosystem very nicely (though I have mostly used it on the JVM), but the underlying library that converts it to JS is very battle-tested and produces great code!

Re: Directly compiling Scheme to WebAssembly: lambdas, recursion, iteration

#16

Last I checked WASM did not yet allow tail jumps. Without these compiling Scheme would be very clumsy. Has this been resolved?

It's being supported in an extension that looks on track to be broadly available across WASM runtimes soonish.

Re: Directly compiling Scheme to WebAssembly: lambdas, recursion, iteration

#17

Ahhhh! A breath of fresh air in this world of ugly Algol-wedged hyper-utilitarianism. (I was going to say “hyper-functionalism”, but the unintended pun confused the sense.) [Although, I must admit that js is actually pretty descent, and can almost be used like Lisp if you look at it hard enough and cross-eyed.]

JavaScript was originally meant to be a Scheme dialect, but corporate people wanted it to look more like Java.

Re: Directly compiling Scheme to WebAssembly: lambdas, recursion, iteration

#18

Tangential question: How interoperable are the top Scheme implementations (Guile. Chez, Chicken, etc.)? Specifically, are libraries (beyond SRFIs) often supported in multiple implementations?

It will depend on which implementation specific behavior a given library uses. For example, guile has `#{}#` syntax for verbatim atoms. If a library uses that it will not work on any other scheme. Guile and gambit also have divergent behavior when e.g. parsing char literals `#\)a` parses correctly in guile but not gambit, and on the other hand `'a'b'c` reads as `c` in gambit but `a'b'c` in guile. And these are just issues with variant behavior in the reader.

The list of these kinds of edge cases is long so it probably winds up being easier to try to just run a library to see if it works. I doubt anyone has done a systematic survey.

Re: Directly compiling Scheme to WebAssembly: lambdas, recursion, iteration

#20
post #19

https://github.com/google/schism For some reason, Google was working on a Scheme WASM compiler, which they got self-hosting. It was then abandoned. I don't really know what they were trying to accomplish with that project.

This was a personal project of a then-Googler, not a Google project.

https://github.com/schism-lang/schism

Previous discussion with comments by the author, https://news.ycombinator.com/item?id=16488605

Post reply on HN