Live data from Hacker News

Ask HN: Is it worth investing in learning Rust?

news.ycombinator.com

41–50 of 82 posts

Re: Ask HN: Is it worth investing in learning Rust?

#41
post #29

Go is a much, much easier language to learn; it's one of the easier mainstream languages to learn. If you really have to ask, like it's a headscratcher between the two, learn Go first and see if you're happy where you land with it. Go is the more popular of the two languages; there's not much "risk" to either of them, but there's marginally less risk for Go. Rust is the more ambitious of the two.

I've written fairly complex projects in both languages, but have a great deal more experience in go. I think tptacek nails it with this advice: go is much easier to learn. One of the things i really like about it is how easy go code is to read coming from almost any language.

It makes sense to get comfortable with go first because the time commitment to achieve basic competence with rust is much greater. Rust will definitely open your mind but it will take some time to get there.

Re: Ask HN: Is it worth investing in learning Rust?

#42
post #11

If this is a career thing, it's usually better to be an expert in one language than an amateur in a dozen of them. Try them both, proceed with the one you like best, because in the end, you will be judged by what you produce with it. No matter how much nerd-cred a language has, it is hard to be productive with a language that you hate. edit: FWIW, we are commenting on a site by a billionaire who seeded his fortune by…

I absolutely agree with you that it's usually better to be an expert in one language than an amateur in a dozen of them.It's not really for a career thing right now, but I like to expand my knowledge especially in systems programming languages, but if Rust become widely adopted, I will be more than happy that I made the right decision to learn it.

If by systems you mean drivers/kernels/etc, that kicks Go out of the running anyway.

Re: Ask HN: Is it worth investing in learning Rust?

#44
Don’t see anyone asking why are you learning either?

Your objectives should come first, then you figure out the tooling. Some have touched on what either is good for, but it really comes to what type of work you are doing/want to do.

In a comment, you mention that you are currently doing JS/Node work. Golang is going to be the closest in terms of use cases - it’s excellent for services. We’ve used it in production with great success, especially when you can leverage goroutines to make things happen in parallel very fast. It’s also fairly maintainable for the web services use case.

I don’t know much about Rust unfortunately.

Re: Ask HN: Is it worth investing in learning Rust?

#45
I don't know Go, so I cannot make a comparison, but studying Rust has been very useful to me as someone interested in the principles of programming because it forces you to think deeply about pointers.

In C, pointers are used for many different things: they stand for arrays and strings (which IMHO is a questionable choice); they are used in types where the structure of an object changes at runtime (linked lists, trees); they provide a way for different parts of the program to refer to a common state; they allow subroutines to modify objects 'owned' by calling routines; they provide a cheap way to pass big structures as arguments to subroutines even when they won't be modified; they provide a way of incorporating large structures as elements of other structures which allows replacing one value with another without a full copy.

Some troubles with pointers are specific to the ways that C uses them: manual memory allocation means that you can use before alloc or after free; the NULL value means that you can dereference an invalid pointer; pointer arithmetic means that a valid pointer can be used to produce an invalid pointer. At possibly some small runtime cost we can eliminate these problems.

But there is one unavoidable problem at the heart of the use of pointers. When you are referring to something with a pointer, are you doing it just for convenience, to avoid copying large structures; or are you doing it to share state with other parts of the program? Things will go horribly wrong if you end up doing the latter when you just wanted the former.

Rust's type system is an attempt to keep track of different uses of pointers to catch such errors without compromising on efficiency. There have been other attempts ([1],[2]) but Rust finally has a rich enough language and library to attempt writing serious programs in.

I think it will be interesting to see whether the authors of such programs find the mental effort of keeping the borrow checker happy worth the efficiency gains of using pointers for both purposes on an equal footing, or whether they fall back to the extreme models of Python (and many other languages) where everything is a pointer which shares state or that of Haskell where there are no pointers by default and one has to switch to a explicit and cumbersome syntax (using the IO or ST monads) when one wants to use shared mutable state.

[1] https://en.wikipedia.org/wiki/Substructural_type_system [2] http://pauillac.inria.fr/~fpottier/slides/fpottier-2007-05-l...

Re: Ask HN: Is it worth investing in learning Rust?

#46
post #37

I have written non-trivial code in Rust and Go. The thing about Rust is that it needs a bit of perseverance and experience of writing a bit of non-trivial code in Rust to really appreciate it. Writing tutorial like code won't cut it. Life-cycle of a Rust developer: https://imgur.com/kNkV7jm Good, bad and the ugly: https://imgur.com/udNcZXa With Go, in my head it is best explained in terms of the scene in the movie: P…

I recently started using Go for a bunch of small services a new product needed. I was amazed at how easy and fast it is to get up to a point of high productivity in Go. The language is really straight-forward to begin working in. Probably the most fun I've had learning a new tool in many years.

Re: Ask HN: Is it worth investing in learning Rust?

#47
Could I have a tangential question: I did learn what is Rust for, but if there is a steep learning curve, it is that much better comparing to C++? I worked about 15 years professionally in C++, it's a solid language, and it is used by many open source projects and companies as well. You can also do "anything" in it, like in Rust, and the abstractions don't incur performance penalties.

Re: Ask HN: Is it worth investing in learning Rust?

#48
post #18

Forget about the language. What kind of systems do you want to build, or want to learn to build? If it is networked systems, Go gets the job done pretty well. If you want to build a game, or want a superior c++, go for Rust.

> If you want to build a game, or want a superior c++, go for Rust. Does Rust have the libraries, frameworks, engines, and communities for developing games? In my opinion, development of any software, whether it's a REST API or a AAA 3D game, isn't just about the language but is actually about 10 other things.

If you want to make a 3D game you can get started much quicker by using an existing engine like Unity and C#.

If you’re interested in building a game engine then C++ will have the most resources.

Re: Ask HN: Is it worth investing in learning Rust?

#49
post #47

Could I have a tangential question: I did learn what is Rust for, but if there is a steep learning curve, it is that much better comparing to C++? I worked about 15 years professionally in C++, it's a solid language, and it is used by many open source projects and companies as well. You can also do "anything" in it, like in Rust, and the abstractions don't incur performance penalties.

Are you one of the three people in the world who can write C++ code without security holes? If not, I'd say it's worth it. That was half joking. :)

The half serious answer I can give is: Do you have a job offer you want to take or at least a solid plan how you can use it professionally? There are so many C++ jobs, that you can most likely find another one that meets all your other requirements (location, salary, domain, etc.), should you decide to leave your current one. I don't think that is the case for Rust yet (But I'm rooting for it! :)

The second point is also my answer for OP.

Re: Ask HN: Is it worth investing in learning Rust?

#50

Earlier quoted context omitted.

Then I must have gotten the wrong idea. I saw a few examples of Rust code with a good amount of generics sprinkled in and given what (seemed to me) the parent comment was suggesting, I assumed that was the case. That said, I remember reading in the docs about many usually OOP related concepts like RAII, boxing/unboxing, operator overloading, the aforementioned generics. You mostly don't care about these things in Go.…

No! - Parametric polymorpism isn't OOP, pretty much every halfway-decent language has it (including Haskell, which is as functional as they come). - Boxing in Rust isn't what you think it is - it's just heap allocation (more like malloc than the monstrosity that is boxing in Java). - Again, operator overloading isn't OOP either. Seriously, is it that hard to believe that "you get to use + and - with your own types" i…

You make it sound like OOP is an inherently bad thing, and OOP is not mutually esclusive with FP as you seem to imply with your Haskell reference.

Funcional can be considered an alternative vs imperative and declarative, and usually languages are a mix of the three. And any of these 3 style can support OOP.

BTW, plenty of half-decent languages don't have generics.

Post reply on HN