Live data from Hacker News

Directly compiling Scheme to WebAssembly: lambdas, recursion, iteration

spritely.institute

21–24 of 24 posts

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

#21

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.

I did fairly standard web dev and devops for 10 years before finding work at a Lispy place. Best of luck to you!!

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

#22

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

The proposal was recently bumped to stage 4 (the penultimate stage) with at least a couple of runtimes working on implementing (besides v8, which has supported it for quite awhile now)

https://github.com/WebAssembly/proposals

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

#23

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 often libraries specific to the Scheme one uses, either built-in or external but easy to install. When writing code one has the choice of picking the one that is specific for the Scheme dialect, or trying to get by by using SRFIs (Scheme Request For Implementation). When using SRFIs, there is a good chance, that they are also available in another Scheme. Perhaps one has to change how things are imported a little. At least for popular SRFIs. However, often (maybe this is a requirement for a SRFI? idk) there will also be an example implementation given with the SRFI, which might allow for easy porting to the Scheme one uses.

I once ported a library I wrote in Racket from Racket to GNU Guile. Since I made use of Racket's for loop forms, I had to rewrite those parts using different constructs like named let in GNU Guile. That was most of the work. I also had to changed how it makes use of multiple cores (places -> futures), but that is to be expected, I guess.

As others have stated, it depends on the code you are porting. If you do not have many dependencies and made a choice to use mostly standard Scheme constructs, you will have not much of a problem to port it to another Scheme.

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

#24
post #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.

Yes. And, once more with feeling: https://xkcd.com/297/
Post reply on HN