Re:Linus Torvalds talks AI, Rust, & why Linux is the only th...
by lifthrasiir on Friday August 30, 2024 @05:17AM
(#41399006)
Here `Result` is very likely not the standard library type, because `std::result::Result` has two generic types for Ok and Err. It will be a partial alias to `Result<T, Error>` where `Error` is used throughout the entire code base to simplify the error handling. (The same pattern occurs in `std::io::{Result, Error}` in the standard library.)
Making `Result` a built-in syntax will disallow such freedom, and Zig has whole dedicated features to tackle problems solved by having `Result` just a normal type. Everything here is just a trade-off and both Rust and Zig have reasonable solutions for their use cases.
Making `Result` a built-in syntax will disallow such freedom, and Zig has whole dedicated features to tackle problems solved by having `Result` just a normal type. Everything here is just a trade-off and both Rust and Zig have reasonable solutions for their use cases.