News for hackers. Stuff that matters.
Re:Rust: Enums to Wrap Multiple Errors by onei on Friday October 08, 2021 @02:34PM (#28802538)
For the type after identifier, the converse is what you see in C family languages. For example:

    // in C
    int x = ...

    // in Rust
    let x: i32 = ...
There's a couple of things that Rust can do better than C here. First, is that Rust is easier to parse because you know that let begins a variable declaration. If we look at C, maybe it's a variable, maybe it's a function and you have to get past the identifier to figure that out. The second more user-facing change is that you can omit the type in Rust if you can derive it from somewhere else, e.g. the return type of a function call or a primitive.

There are no comments on this comment yet.