4 ms·
Why was LISP not one of the first languages able to compile to WASM? I've been curious ever since the awesome WASM project started tracking different projects.
by bevr1337 1y ago
Why was LISP not one of the first languages able to compile to WASM? I've been curious ever since the awesome WASM project started tracking different projects. They use emojis for progress and LISP has been a hatching egg.
- no_wizard 1y agoIt sorta has been. As a language design it is already native via the WAT[0] which compiles to web assembly. [0]: https://webassemblyman.com/wat_webassembly_text_format.html https://webassemblyman.com/wat_webassembly_text_format.html
- bevr1337 1y agoDo you know why only sorta? My understanding is that only toy implementations exist right now but nothing production ready. I'm poking around Google and GitHub and not finding any new information. > Implementing Lisp onto WebAssembly is so obvious that you may wonder why somebody did not have this idea long ago. I did find this on the Femto GitHub and got a chuckle. Yes, dear author, that is exactly the piece of information I want explained. Too funny.
- no_wizard 1y agoIt doesn’t have to very last trapping of a proper LISP if I recall correctly is why I say kinda. It’s an S expression language though with some similarities to LISP
- bevr1337 1y agoThanks for clarifying. I've been speculating on this for a while but haven't had the chops to know what to research. The details folks are providing are yielding much better search results.
- dmkolobov 1y agoIf I had to guess: 1. lack of native GC, you had to roll your own by providing a runtime. 2. lack of tail-call elimination in V1 of the spec. This essentially forces you to trampoline everything.
- stassats 1y ago> lack of tail-call elimination But lisp doesn't need TCO.
- bevr1337 1y agoWhoa, what a surprising fact! I had not considered TCO in LISP was "nice to have." That's a good example where it's easy to hack but hard to make production ready.
- dreamcompiler 1y agoCommon Lisp doesn't technically require TCO but Scheme does. IMHO a Common Lisp without TCO is not a serious tool because I cannot write tail-recursive code with it.
- wavemode 1y agoTypical programming style in Common Lisp is procedural, not functional. The CL spec doesn't guarantee tail-call elimination, and most CL implementations don't guarantee it either (it could be on or off depending on the current optimization level). So most people don't bother relying on it.
- dreamcompiler 1y agoTrue. My CL code is atypical because I prefer functional style to iterative style. I know how to use declarations to turn on TCO for implementations that support it, which is most of the big ones. ABCL being a notable exception.