• nous@programming.dev
    link
    fedilink
    English
    arrow-up
    4
    ·
    2 months ago

    Some people might dismiss Rust as being “unelegant” or “ugly”, but the verbosity actually serves a good purpose and is immensely helpful for building large-scale applications:

    Here rust is trying to be unambiguous by forcing you to write just enough context when needed. It is not unnecessarily verbose at all and is not trying to be absolutely explicit about everything. When there could be more ambiguity, rust errs on the side of being more explicit which increases the verbosity. But when it is less ambiguous then it favors being less explicit. Hence why you can omit types and lifetimes in most situations but require them when it is not obvious what they should be.

  • trevor (he/they)@lemmy.blahaj.zone
    link
    fedilink
    English
    arrow-up
    3
    ·
    2 months ago

    As someone whose only other language was very beginner-level Python before learning Rust, the part about not treating the borrow checker as an adversary, but as a companion, mirrors the point at which I began rapidly improving.

    I like to say that the Rust compiler rules are like having a senior engineer over your shoulders to help you avoid writing (certain kinds of) bad code.

    There are still times when the borrow checker becomes my adversary (like needing to share data in threads), and it is painful, but they become less frequent over time.