this post was submitted on 11 Jan 2024
34 points (87.0% liked)
Rust
5981 readers
101 users here now
Welcome to the Rust community! This is a place to discuss about the Rust programming language.
Wormhole
Credits
- The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Jeeze, I knew that simplicity was the goal (and I think they largely succeeded in that), but that quote is so explicitly condescending. "They're not capable of understanding a brilliant language"?
I disagree slightly with the need to add full ADT support to the language to implement that style of error handling, because Pike et al. had no problem adding "special cases" to the language: in particular, return values are essentially tuples, but that's the only place in the language with that concept. So they wouldn't need to introduce user-definable enums and full pattern-matching to have better error handling. I can think of a couple approaches they could have used:
error
value in the return types, and it must be the last element in the "tuple"error
, the other values must be zero/nilnil
, discard it if so, return early if notswitch
statement to destructure it (akin to how type switches have their own bespoke syntax/keyword).