Live data from Hacker News

How I went about learning Rust

eli.thegreenplace.net

61–70 of 303 posts

Re: How I went about learning Rust

#61
post #39
post #9

Earlier quoted context omitted.

As someone with extensive experience with Rust and a teensy bit of experience in Go I can tell you that I adore Rust for every use case I’ve tried it out for *except* for network services. It works ok for low level proxies and stuff like that; but Python/Flask-level easy it is not. Meanwhile my experience with Go has been the reverse. I’ve found it acceptable for most use cases, but for network services it really sta…

Yes. Rust is for what you'd otherwise have to write in C++. It's overkill for web services. You have to obsess over who owns what. The compiler will catch memory safety errors, but you still have to resolve them. It's quite possible to paint yourself into a corner and have to go back and redesign something. On the other hand, if you really need to coordinate many CPUs in a complicated way, Rust has decent facilities…

Noob question - What does go lack that makes it hard to write your multi threaded meta verse viewer

Re: How I went about learning Rust

#62
post #3

I have been thinking to myself whether I should pick up Go or Rust as a new language this year. Coming from a NodeJS background, Rust looks a tad more complicated but it looks cooler. There are also more job listings looking for Golang than Rust which makes me wonder if Golang might be a more rewarding investment? What would be a good use case of Rust than Golang cannot do given its extra complexity and potentially l…

I founf myself in your same situation a few months ago. I chose Rust and regret it Rust is a better c++. It's not appropriate for anything you wouldn't program in c++. The coding speed is slow So if you are thinking about learning a new language to program your future apps you currently code in node, choose Go

> Rust is a better c++

The Rust language is a far better C++.

In practice, the compile time and binary size of Rust are out of control, which makes Rust far from being a slam dunk over C++. Crossing my fingers this will change!

Re: How I went about learning Rust

#63
post #3

I have been thinking to myself whether I should pick up Go or Rust as a new language this year. Coming from a NodeJS background, Rust looks a tad more complicated but it looks cooler. There are also more job listings looking for Golang than Rust which makes me wonder if Golang might be a more rewarding investment? What would be a good use case of Rust than Golang cannot do given its extra complexity and potentially l…

Since you're coming from a NodeJS background, you'll want to pick up an introductory textbook about C as well. Rust implicitly relies quite closely on the C machine model, and introductory books about Rust (such as "The Rust Programming Language") don't do a very good job of conveying the nitty-gritty details of that model to novice coders. This is a pretty nasty pitfall when trying to code in Rust, and it's importan…

This is the main reason I’d recommend that a Node programmer learn Go first.

I haven’t learned Rust yet, thought I’m quite keen to do so, but I have an (ancient) background in C, C++ and 8-bit assembly. I don’t find that I really use much of that knowledge when I work in Go, even though Go is still a lot closer to the metal than Node.

Re: How I went about learning Rust

#64
I am currently starting with rust too. I'm coming from a C#/ASP.NET/Angular/SQL background. I really like the official documentation so far. https://doc.rust-lang.org/book/ch00-00-introduction.html

I also really like this quick introduction. https://fasterthanli.me/articles/a-half-hour-to-learn-rust

You won't "learn" rust by reading it but you get a pretty good picture of the basics in my opinion.

Maybe someone more experienced can rate these as i don't have comparisons yet.

Re: How I went about learning Rust

#65
post #39
post #9

Earlier quoted context omitted.

As someone with extensive experience with Rust and a teensy bit of experience in Go I can tell you that I adore Rust for every use case I’ve tried it out for *except* for network services. It works ok for low level proxies and stuff like that; but Python/Flask-level easy it is not. Meanwhile my experience with Go has been the reverse. I’ve found it acceptable for most use cases, but for network services it really sta…

Yes. Rust is for what you'd otherwise have to write in C++. It's overkill for web services. You have to obsess over who owns what. The compiler will catch memory safety errors, but you still have to resolve them. It's quite possible to paint yourself into a corner and have to go back and redesign something. On the other hand, if you really need to coordinate many CPUs in a complicated way, Rust has decent facilities…

Minor nitpick but goroutines are absolutely not preemptable, they’re cooperative. The go compiler regularly sticks in yield statements around IO, and certain function calls, but you absolutely can starve the runtime by running a number of goroutines equal to the number of cores doing heavy computation, just like Node.JS’s event loop.

Re: How I went about learning Rust

#66
post #4

Earlier quoted context omitted.

Just thinking out loud, does go compile to WASM? I often see performance critical WASM snippets written in rust, but never in Go.

Go compiles to WASM but the stock compiler is pretty bad for this and your binaries are like 2MB+ in size. TinyGo is an LLVM based compiler that targets microcontrollers but also has a WASM target and that creates considerably smaller binaries, but it doesn't fully support all of the Go standard library.

TinyGo is great, I used to to program microcontrollers and there wasn’t anything I really missed, though admittedly it was a very small program.

Re: How I went about learning Rust

#67

Earlier quoted context omitted.

I think rust is the new haskell. After spending 7 months learning it, I can say I really enjoy the language, but there's no job in it and in my opinion, they take academic decisions that make the language way more complex than it should. Also, the community is toxic. For example, generics in Go were criticized by some, praised by others. You have the feeling that you can freely share your opinion in the go community…

> there's no job in [Rust] As of today, indeed.com lists 1,500 remote jobs mentioning Rust vs. 4,018 jobs mentioning Golang. That's not so bad. (However, there's no way to tell how many of those listings are Rust-specific as opposed to polyglot job descriptions.) > Also, the [Rust] community is toxic. Speaking slightly humorously, if you think Rust community is toxic, try expressing your dissatisfaction with Swift or…

Most "jobs mentioning Rust" are in the crypto space for some reason. I can't fault devs for thinking that such "opportunities" are just not very serious compared to the alternatives.

Re: How I went about learning Rust

#68
post #3

I have been thinking to myself whether I should pick up Go or Rust as a new language this year. Coming from a NodeJS background, Rust looks a tad more complicated but it looks cooler. There are also more job listings looking for Golang than Rust which makes me wonder if Golang might be a more rewarding investment? What would be a good use case of Rust than Golang cannot do given its extra complexity and potentially l…

Most of my experience is with python and js. I feel like if you have experience with python, go resembles a lot. While if you have some experience with js, rust feels like an extension (but takes time to feel comfortable). If you like arrow functions, using map, filter, etc. You will feel amazing when using rust. Those are my 2 cents.

And spite of some other comments, I found writing web servers in rust okay, and I think go is also fine for web services. And with go it also feels a bit like python when using other libraries, I don't know where to start. While rust with cargo is more similar to the npm experience

Re: How I went about learning Rust

#69

A bit unrelated: Maybe I'm wrong, but I get the impression that the people who learn Rust, tend to be quite experienced programmers. I have yet to see complete beginners document their journey, starting with Rust. I've seen lots of people do that with C/C++, Java, and the other usual suspects - but Rust still seems like a language for at least intermediate programmers.

I think you're right but that it's not necessarily a bad thing. Rust's truly killer features probably won't appeal to you on a visceral level until you've been on the wrong end of a thorny problem like a race condition. Otherwise you might think it's a needlessly strict C++ clone.

Re: How I went about learning Rust

#70
post #39

Earlier quoted context omitted.

Yes. Rust is for what you'd otherwise have to write in C++. It's overkill for web services. You have to obsess over who owns what. The compiler will catch memory safety errors, but you still have to resolve them. It's quite possible to paint yourself into a corner and have to go back and redesign something. On the other hand, if you really need to coordinate many CPUs in a complicated way, Rust has decent facilities…

Minor nitpick but goroutines are absolutely not preemptable, they’re cooperative. The go compiler regularly sticks in yield statements around IO, and certain function calls, but you absolutely can starve the runtime by running a number of goroutines equal to the number of cores doing heavy computation, just like Node.JS’s event loop.

This changed in Go 1.14 on most platforms: https://go.dev/doc/go1.14#runtime
Post reply on HN