logoalt Hacker News

packetlost • today at 3:03 PM • 2 replies • view on HN

An JavaScripts is? Rust is probably a more performant target regardless


Replies

lpil • today at 3:07 PM

Surprisingly yes! JavaScript's allocator and garbage collection system is quite well suited to immutable programming.

Rust is a very poor compile target as the compiler is slow and not commonly available, and the aspects of Rust that make it good for humans to write make it a poor choice for compilers to target. With humans the produced code is verified, but with a compiler the compiler is what is to be verified, so the inflexibility of Rust are largely a hindrance compared to other native compilation targets.

➕ show 1 reply
__MatrixMan__ • today at 3:24 PM

I don't get the impression that javascript is among Gleam's targets because of performance.

- server target: BEAM

- client target: js

Once you've covered those bases, you're kind of done.

If the server needs to do something special in an OS process... might as well let the OS mediate that interaction so that it can be fully generic, rather than trying to bend the language around whatever the unknown action might be.