Possibility of adopting Rust's Error Handling?

ryuukk_ ryuukk.dev at gmail.com
Sat Apr 2 17:08:48 UTC 2022


In my opinion Rust error handling is one of the worst

I much preffer Go/Zig/Odin, my favorite would be Odin's one

     f, err := os.open(...)
     if err != os.ERROR_NONE {
         // handle error
     }
     defer os.close(f) // will be executed at the end of the scope

Multiple returns is the trick!! simple, easy to read and handle, 
i can understand if one prefer exception sicne they bubble up, 
even though i think it encourages a lazy design of APIs, for 
that, then Zig's one will suits you better, since it's more 
strict about that part


More information about the Digitalmars-d mailing list