5

Have any of you already used Rust? And what do you think of it? :)

Personally, I love it.

Comments
  • 2
    Tactical pin
  • 2
    I use it for more or less everything now. Love it.
  • 2
    I do at work and for private stuff.

    It's really nice
  • 3
    @olback yeah, me too! I can't go back now.. using anything which allows null pointer dereferences just seems unreasonable now.
  • 3
    Only rust i know its the game
  • 1
    Also really liking it, but haven't done anything bigger than basic stuff.

    I'm always riddeling when to use str and when string (and why).

    Also due to some changes you always have to look out which version (e.g. stable, nightly) of Rust you have to use for some libs.
  • 2
    @KnutKnutsen yeah, it is kind of fiddly at the beginnig.. Strings are basically objects stored in the heap, while str's are basically only a view into a utf-8 encoded string, so they are only references basically. so you can't copy their memory into an object, unless you use a String object.
    And the only real disadvantage of Rust (that I see) is that many libraries are still work in progress, and there are very few frameworks to use. Generally Rust has a "bottom up, but correctly" approach, so there are few libraries, but the good ones are.. godlike. They can be extremely powerful, because they are efficient, safe and generic.
  • 0
    Do you think Rust will slowly replace Java in corporate in the future?
  • 3
    @heyheni that's hard to say, because Rust is not exactly aiming to be a better Java. Rust has a different approach to object orientation and is more focussed on efficiency than on simple conceptualization, although designs in Rust tend to be simpler because they are more explicit and robust.
    I think they are a different niche. But I can definitely see Rust replacing C++ and maybe even C in large parts.
  • 0
    @fuckwit Where do you work? :) I want too. My project manager decided to use Go for backend instead of Rust 😩 we could have even used Rust for frontend using WASM, but he was not sure if the technology is mature enough yet.
  • 1
    @simulate well I am the only one that uses rust in my company :D for our normal backend tasks it's mostly ruby or php (I luckily don't have to touch php :D)

    And I would agree with your boss that rust and wasm front end is not mature enough. It's getting there but even wasm itself is missing a lot of stuff.
  • 1
    @fuckwit Yes that might be true.. I just believe it would be worth it to invest time into it and contribute to the language. It is a much better long term investment compared to Go, in my opinion, because Go is just so much more prone to bugs. But of course my company mostly wants to get results as soon as possible, and believes Go will provide that. I don't see it, in the long run.
  • 0
    @tague Wait that's just mean.. Even meaner than the rust compiler 😂
  • 1
    @tague hey that doesn't look bad. Some more error handling and fewer unwraps(except in tests) and that's it.
  • 0
    @tague Oh I don't think it's that bad. I really like the err_type macro! I just can't wrap my head around the macros 😂
    What I would improve here is to use the assert! macro in tests, which will output useful information and takes less code, and I think you could make more use of iterators and functional functions like map and fold. These usually take less code and make the code easier to understand and edit. Also they are safer because they usually work with the Option and Result types, so that there is less implicit meaning in the code, as is the case with using a bool to indicate the result of the operation. Usually it is best to return an Option or a Result if an Operation can turn out empty or fail, respectively.
  • 0
    @heyheni I'd like to say that D would be more likely, but D doesn't really have any major corporate backers, despite having really good mindshare on the core team.
  • 0
    @tague Yeah it can become hard to remember the types when working with them.. but check out things like Option::flatten and Iterator:: flat_map. They will take away one level of nested Options.
  • 1
    I use rust at work unfortunately, its the least flexible, most annoyingly handholding piece of crap ive ever seen
  • 0
    @tague absolutely
    @yellow-dog it takes a while to get comfortable with it, you can't be impatient. It is called "fighting the borrow-checker" for a reason 😅 but once you learned all the rules it really makes sense and you will barely ever have run time crashes anymore.
    In rust I can make extremely complex additions and when it compiles, it just runs, and most of the time, it does what I want.
  • 1
    @simulate been using it for a year now. Guess what, i dont have runtime crashes in ocaml nor scala, because i know what im doing. Rust is cool if you are a beginner in low/er level programming but a pain in the ass if you try to do anything remotely complex.

    And just for the record, i dont mean making a rest api, i mean heavy maths, encryption, parsing, networking, the things its supposed to be good at.
  • 0
    @yellow-dog check out the nom crate. I don't think parsing can get any simpler.
    Here I use it in one of my projects:
    https://github.com/mankinskin/...
    Some parts are admittedly a bit ugly, but it handles a lot of cases.
  • 0
    @tague exactly 😂 I should really fix that
  • 0
    @yellow-dog but as I said, Rust is focussing on efficiency a lot. It is not meant to replace Java or scala or anything. If you want performance close to C, on par with C++, then you can't get anything better than Rust nowadays.
  • 1
    @simulate yeaaaah nope, thats just a weak imitation of what functional languages do out of the box.
    Edit: i hate cpp but u would argue that rust is any better for that specific usecase than c.

    @tague ill probably write a blogpost about it because its too long to fit in a rant
  • 0
    @yellow-dog I have only used haskell as a functional language yet, and of course, many things are wonderfully simple in functional languages. But most functional languages are simply not fast enough or allow for such deep fine grained control as C or C++ do. Rust kind of meets the middle, with allowing deep control under strict rules, and providing functional style libraries. But it is still an imperative language.
  • 1
    @yellow-dog I’ve heard it can be really handholdy, is it that bad?

    I love C and I thought of maybe trying Rust to see what it’s like. Not to replace C but just to add to my tool kit.

    I’ve seen the syntax but I need to know the good parts along with the bad parts with no sugarcoating on either side so I can judge it properly so I know if I should give it a chance.
Add Comment