|
|
|
|
|
by flohofwoe
663 days ago
|
|
> How would you like Rust to describe such Types? If I knew the answer I would design programming languages ;) Replacing `Either<this, that>` with something like `this | that` like in Typescript might be going into the right direction though. Zig has similar syntax sugar for Rust's Result<> and Option<>. Such things are so fundamental that they should be part of the language instead of the stdlib IMHO. > Don't see how this is a Typing issue, sounds more like API issue Designing an API is a typing issue, because an API is essentially nothing more than a list of types. |
|
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.