3 ms·
This is unrelated, but do you know if Rust's omission of exceptions is a consequence of the borrow checker, or an explicit design choice? I get that most people
by _yawn 8y ago
This is unrelated, but do you know if Rust's omission of exceptions is a consequence of the borrow checker, or an explicit design choice? I get that most people come to Rust from C++, but as someone coming from a higher level down to Rust, things like the complicated error handling and lack of keyword arguments bother me.
- steveklabnik 8y agoIt was an explicit design choice. Keyword arguments are something that we haven’t totally rejected, but many are skeptical. We’ll see!
- _yawn 8y agoSkepticism towards keyword arguments is something I have trouble understanding. Is it because of some performance consideration? Thanks for your answer!
- Retra 8y agoKeyword arguments tend to lead to bloated functions that try to account for every possible situation. So they're unidiomatic when compared to C-style functions which tend to always do the same thing in the same way every time you call them. Of course, I'm assuming you're imagining an implementation where you are allowed to omit keywords to set default values. Naturally if every argument is always required, you don't have this problem.
- _yawn 8y agoI mostly miss them for constructing objects with default values, yes. The alternative is the builder pattern, which involves a lot of boilerplate.
- algesten 8y agoTreating errors as values might be the best shift I've done as a programmer in later years. In fact, after learning it in rust, I took it with me back to typescript. I can only recommend trying it. It's magical!