Live data from Hacker News

Exercises to Learn Rust

rust-exercises.com

31–40 of 129 posts

Re: Exercises to Learn Rust

#33
post #6

Earlier quoted context omitted.

Being the first language to contest C++ in places like the kernal is a pretty big deal, no? It helps that the borrow checker is a new idea around being safe without gc.

It is, but I see people using it in places where Java would be good enough.

Java is tremendously unfriendly to actually use. Sure, it's tolerable inside a corporate environment with established build/deployment systems, but there are few languages that make the "build a random repo off GitHub" hurdle higher than Java.

Re: Exercises to Learn Rust

#34
post #22

This looks like a great resource! https://rust-exercises.com/03_ticket_v1/07_setters This shows why I wouldn't use Rust for anything. Seems like a lot of verbosity for gains that don't really apply whatsoever for the kind of work I do (web apps and APIs). You have to remember let/mut fine, but then ownership/borrowing, and finally this `into()` thing - yuck! Like washing your face with sandpaper.

There’s a world outside of web development.

He's right, though. Languages today shouldn't force you to jump through low-level hoops if you just want to write high-level logic. Likewise, the low-level devices should be easily and ergonomically accessible. Rust is phenomenal at the latter but weak at the former.

Re: Exercises to Learn Rust

#36

This looks like a great resource! https://rust-exercises.com/03_ticket_v1/07_setters This shows why I wouldn't use Rust for anything. Seems like a lot of verbosity for gains that don't really apply whatsoever for the kind of work I do (web apps and APIs). You have to remember let/mut fine, but then ownership/borrowing, and finally this `into()` thing - yuck! Like washing your face with sandpaper.

It seems like Rust is doing a pretty good job of applying to web apps and APIs:

https://www.techempower.com/benchmarks

Re: Exercises to Learn Rust

#37

This looks like a great resource! https://rust-exercises.com/03_ticket_v1/07_setters This shows why I wouldn't use Rust for anything. Seems like a lot of verbosity for gains that don't really apply whatsoever for the kind of work I do (web apps and APIs). You have to remember let/mut fine, but then ownership/borrowing, and finally this `into()` thing - yuck! Like washing your face with sandpaper.

You get ridiculous performance gains with Rust a web backend. Even Microsoft is rewriting part of their C# backend to Rust on the 365 application side of things. Which is where you get to deal with the hefty ms-graph api which handles literal fucktons of data.

Anyway. It is more verbose than something like Go or Python. I’m not sure it’s really so bad compared to most languages, but some of the benefits you get from the verbosity is that you gain a lot of control over how you use mutability and the borrow checker or how you work with memory in general. Things which are foreign to many developers today, but you shouldn’t compare a Rust implementation to a C#/Java/Python/Ruby/Node/Go api, you should compare it to a c/c++ api… which is where Rust is just so much “safer” for production.

We have Node APIs in Typescript, we have Python APIs with FastAPI, we have C# web APIs and we have a few Go APIs. We’re perfectly happy with those, well maybe not the fact that we use so many languages, but we’re happy with them. Where we use Rust is where we used to use C, and the benefits are massive. You get the same sort of performance, but you also get an environment where programmers with less experience working without garbage collection can do work we just couldn’t have them do with C.

Re: Exercises to Learn Rust

#38
post #22

Earlier quoted context omitted.

There’s a world outside of web development.

Also, just because these examples are verbose doesn't mean that all Rust code is this way. Accessors/mutators aren't used super often in my experience, and the builder pattern is used occasionally, but isn't pervasive. (I have historically been very skeptical of Rust on the web, but by now, I find it pretty pleasant. I of course know Rust very well already though.)

> I of course know Rust very well already though

Understatement of the week ;)

Re: Exercises to Learn Rust

#40
post #22

Earlier quoted context omitted.

There’s a world outside of web development.

He's right, though. Languages today shouldn't force you to jump through low-level hoops if you just want to write high-level logic. Likewise, the low-level devices should be easily and ergonomically accessible. Rust is phenomenal at the latter but weak at the former.

What languages scale better in that regard? Genuinely interested in recommendations.
Post reply on HN