Hacker News new | ask | show | jobs
by christiansakai 1863 days ago
I think it is a disadvantage to write Rust on the frontend. Frontend code moves too much and quick prototyping/iteration is more important than memory control.

As for typing, just use TypeScript. It is really good enough already.

2 comments

I disagree TypeScript is good enough.

It's easy to run into untyped (or partially typed) dependencies (a massive pain to write) or in internal code which uses any/unknown somewhere (causing typing holes which allow for whatever inputs).

I love types but I can't trust TypeScript types to be valid, I've been bit too many times.

Rust (or any other really typed language) would be great if the solutions are mature enough. It's not just for memory control.

I haven't had many issues with it. My development cycle has normally involved getting the basic functionality of my program to work, then adding a UI layer over it with the GTK crate. In terms of how fast it is to prototype/iterate, I could very easily manipulate and edit the UI file in Glade, then rebuild the program in only a couple seconds to test the result.

>Frontend code moves too much and quick prototyping/iteration is more important than memory control.

You can have both, really: Rust makes a lot of compromises on it's debug builds, but it compiles lightning fast. As I said above, you can change your program and see how it looks in realtime by simply dropping "cargo run" into the shell. There's not much I can do for you here except tell you to see for yourself.

I see. Last time I saw Rust compilation speed isn’t that fast.
First time compilation is notoriously slow, since Rust has to compile your dependencies into object files, and to make "release" binary, it has to re-compile those same dependencies to make a statically linked and optimized executable. The actual debug process is fairly quick though, since it can just link the deps to a lazily compiled binary for debugging purposes.