4 ms·
If Clojure offered a direct compile-to-native option for any platform (desktop/mobile/WASM) with no JVM in between, I suspect it would explode in popularity.
by lenkite 6y ago
If Clojure offered a direct compile-to-native option for any platform (desktop/mobile/WASM) with no JVM in between, I suspect it would explode in popularity.
- fnordsensei 6y agoIt does, via GraalVM. Babashka, for example, leverages this: https://github.com/babashka/babashka https://github.com/babashka/babashka
- yen223 6y agoIf this were true, wouldn't something like racket or common lisp be more popular than it currently is?
- lenkite 6y agoCan you point me to a guide that shows how to use racket or common lisp on mobile operating systems like android/ios or run them as WASM web-apps ?
- auganov 6y agoI don't know of a specific example, but Lisps have a pretty long tradition of coming with architecture specific assemblers. I'm sure there are many CL implementations that can target ARM. The problem is any sizable Lisp needs quite a lot of stuff available at runtime. A trivial program would still likely[0] be a sizable blob with a memory penalty. If anything, I'd say Clojure (cljs especially) actually bypasses this problem by leveraging a platform's privileged language. Purely theoretically, there's no reason why you couldn't have a mobile device built around CL. But if you want to target what's already out there, a parasitic design works much better. Also, on the popularity front I guess it's a bit of a glass half full situation. Compared to other Lisps, Clojure is no doubt dominating. Among what I'd call "alternative languages" it's a tough call. [0] Have to mention there's a lot of diversity in CL implementations so this is certainly not universally true. But I would assume this is true for something that has all the conveniences you'd want.
- soegaard 6y agoRunning Racket BC on iOS https://defn.io/2020/01/05/racket-on-ios/ https://defn.io/2020/01/05/racket-on-ios/
- lenkite 6y agoWow, this is rather interesting. Just a bit of doable C-interop needed. Thanks for the link.
- fulafel 6y agoWhat advantages do you feel WebAssemlby would have vs the current JS as a compile target?
- lenkite 6y agoSize and Performance for large web-apps presumably. For example, Figma which is currently wiping Sketch's face on the floor is written in C++ and compiled to WASM. https://medium.com/javascript-in-plain-english/made-with-webassembly-e2115fe7d97c https://medium.com/javascript-in-plain-english/made-with-web...
- fulafel 6y agoWasm was designed for C/C++ and pretty hostile toward dynamic GC languages. Clojure is very different from C++ and can leverage JSVM GC and dynamic dispatch system, which are a lot of code and highly optimized. Even disregarding the perf problems the scale of implementation effort and resulting wasm code size would be prohibitive. Not to mention losing easy low friction interop with JS ecosystem libraries.
- lenkite 6y agoIt's only a matter of time before we have WASM ecosystem libraries - modules that can be loaded like JS modules. https://webassembly.org/roadmap/ https://webassembly.org/roadmap/ Moreover an immutable language like Clojure doesn't necessarily need an GC - one could probably leverage ARC to great effect. I don't think JS will rule the roost a decade from now. It's simply too slow and most folks actively dislike the ecosystem of NPM hell.
- fulafel 6y agoFor that track of thought - There are some more static nascent Clojure inspired languages around that might fit. Eg this one, doesn't have GC either: https://github.com/carp-lang/Carp https://github.com/carp-lang/Carp