9

I'm about to start learning Rust. Eventhough I kinda hated on several times after looking at it again it definitely looks rather nice. Judging by some papers I've read it also seems to be really fast (as fast as C in many cases, even for complex systems like mem allocators or garbage collectors)

How many of you know Rust? Any major advantages/disadvantages I should know about?

Comments
  • 1
    @24th-Dragon That's the biggest turn off probably and one of my previous critizisms. But I think if you can wrap your head around it, it should be workable (and hey, maybe I'll enjoy it even)
  • 0
    I have already started a list of things that bug me about it... Maybe I'll post it tomorrow when I'm back at work. But overall I'm quite enjoying it
  • 1
    Good to see you are enjoying it. I have deployed 1 project written in rust to prod and overall like writing rust but don't get opportunities to do that. I have to write Go full time. :((

    let me know if I you need clarification with something, maybe I can help
  • 0
    I think the biggest "disadvantage" of rust in comparison to e. g. Java (because I don't know C) is that you have to think about your program before you write it. Otherwise it won't work or you have to rewrite it.
  • 0
    @M1sf3t If you're coming from JavaScript mostly, I would maybe recommend starting with C. It's not that complicated and kinda fun (in it's own way lol) and it doesn't hold much hands. Definitely great way to learn low level languages
  • 0
    @ishanjain28 Hey, thanks. I do have a question actually: Without match I assume you can check for an enum variant via ==, e.g. `nullable == Option::None`. But what about variants with attributes. Can you do `let a = Option::Some("foo"); ... if a == Option::Some {}`?
  • 1
    @12bitfloat == doesn't work if the type in option is not eq. But you don't need a match block to pattern match. If you just care about one case you can use

    if let Some(_) = a {... }

    But for Option there is also a.is_some()
  • 1
    So the reason to use Rust over C is a bit like using TypeScript over JavaScript.
    They both lessen the amount of time you need to debug by being more stricter at compile time.

    In JS, if you pass a parameter of the wrong type by accident, you either need to have tests for it or run it yourself. The TS compiler will tell you that at compile time.

    Rust goes further than C with respect to memory. In C, you need to check yourself if you've freed some memory or if you're using a pointer that is no longer valid. This is even very difficult to write tests for and requires a lot of debugging. C++ has this as well.
    Rust will not allow these kind of things and won't compile if it would happen.

    Rust and TS both do the same thing in respect to what they try to replace: Decrease testing and debugging time a lot at the cost of a little bit of coding time.
Add Comment