Live data from Hacker News

Rust needs a web framework

ntietz.com

391–395 of 395 posts

Re: Rust needs a web framework

#391

Earlier quoted context omitted.

>Result where E implements Error` and lack of nulls or exceptions This all goes out the window when people throw “unwrap” all over the place because “this should always succeed”.

In any program there are errors you can handle and errors you can't, errors whose vary existence suggests something has gone horribly wrong. What else should you do in that situation but panic?

I see unwrap used all of the time on things that could be recoverable if people bothered to write the control flow. “Meh, let the program crash” is easier because unwrap is much less verbose than the match unpacking or carrying results to callers.

Rust has exceptions, they are just named Result and people just as frequently decide not to handle error results as not catch exceptions in my experience.

Typed exceptions are just as good as what rust offers IMO.

Re: Rust needs a web framework

#392

Earlier quoted context omitted.

No types in Elixir, I think a better comparison is actually Gleam, it is Rust-like in type system but is built on and interoperable with Erlang/OTP.

Both are exceedingly slow and memory-hungry. The average user of Rust might get shocked and never touch these again. Now F# on the other hand…

Yeah I mean it depends if you want the benefits of OTP or not. To be honest, while it was nice as an all in one solution 50 years ago, these days there are all sorts of solutions for deployment so I wouldn't want to choose a programming language just because of its additional features in the form of OTP, especially if it entails dynamic typing or slower speed.

Re: Rust needs a web framework

#393
post #295

Earlier quoted context omitted.

Rust makes an '.exe', Java makes a '.jar'. I think people want to write programs that run on an OS rather than an interpreter.

For the majority of executing code, there is no fundamental difference when it comes to a JIT compiler. Besides, GraalVM can produce a native executable for pretty much any JVM language/program.

Last I checked there was a significant disadvantage to using rather basic Java JIT code in a cloud environment: slow startup time and poor initial performance in terms of requests per second & latency meant scaling on demand didn't work very well. I suggested we move to GraalVM and AOT compilation on that project but we just ended up over-provisioning by a significant factor to smooth things out.

Re: Rust needs a web framework

#394
post #264

Earlier quoted context omitted.

It's an investment in energy efficiency

The advantages of a language like Rust where most interactions are blocked on either user input or network IO are fairly limited. Rust shines when things are CPU or memory bound primarily. Web applications are mostly IO bound. Which is why people have been getting away with fairly poorly optimized interpreted languages for decades. Even when computers were a lot slower than they are today, this worked fairly well.

>The advantages of a language like Rust where most interactions are blocked on either user input or network IO are fairly limited. Rust shines when things are CPU or memory bound primarily. Web applications are mostly IO bound. Which is why people have been getting away with fairly poorly optimized interpreted languages for decades. Even when computers were a lot slower than they are today, this worked fairly well.

I kinda agree with this, but the speed of a language like Rust changes so much of the mental calculation. Like in Python/JS/Ruby you try to offload as much work to the database as possible, because its so much faster. In Rust, you might not need to do that, because its such a fast language.

Re: Rust needs a web framework

#395
post #29

What make rust better than any language when the bottleneck is the network or the database?

Since Rust can be as fast as the database, you can do some stuff on the application code and be fast where you can't with some interpreted languages. That means that the database is not as overloaded as usual.
Post reply on HN