← Back to context

Comment by QuiCasseRien

1 year ago

[flagged]

I can see why people don't like to write Rust. It is more tedious, harder because of the ownership model, and has a very steep learning curve.

What I don't get is what people have against programs written in Rust from the bottom up. They are safer to use, introduce far fewer vulnerabilities, and you can even locally reason about the code much better than in typical 'unsafe' languages like C++.

  • It seems like your first paragraph answers the question in the second. If it is harder to use and learn then that reduces the value of free software released using it as that software is then harder to modify, fix, contribute to, etc. The tradeoff for Rust being hard should be more security and fewer bugs. The additional cost here, and the one that the OP is probably annoyed with, is that it moves away from the languages/platforms that MS has traditionally used and that developers who work on that platform expect.

  • The non-stable ABI, forcing all-statically linked binaries, is also a thing.

    • Which has next to zero impact on Windows applications, which ship their own DLLs anyway (besides stuff like DirectX).

  • > and you can even locally reason about the code much better than in typical 'unsafe' languages like C++.

    Do you have an example of this? I'm just a TypeScript guy who never had a fair chance to use C++ or Rust for long, so I'd be curious how what you say is true.

    • One of the strongest example for me is newtypes. I strongly believe in Parse, don't validate (https://news.ycombinator.com/item?id=21476261) and think Rust's newtype pattern is able to really enforce this strongly.

      When writing a Rust program, I can often basically express it as a single value (the input) being sequentially converted in type. The typestates, if you choose this name, allow great compile-time verification of most desired properties. You are really forced to describe the way the core logic flows in a modular way.

      However this is just one and likely not even the most prominent aspect making Rust so great. Local reasoning also becomes easier via explicit opt-in mutability, and function signatures always being the only relevant source of truth when regarding their compile-time evaluatability (especially compared to C++ templates). No accessing uninitialized memory, a very simple implied notion of a constructor as merely a method without a self parameter, soundness of all received types, likely much more...