fred_
Joined 2 years ago
Karma
32
Submissions
19
Member since
Jul 29
https://fredrikmalmo.com
View on Hacker NewsJoined 2 years ago
As you, and many others, have pointed out, `?? ""` does not do what `.unwrap` does. `unwrap_or_default` would have been a better comparison for what it actually does. What I tried, and failed, to communicate, was that both can be used to "ignore" the unwanted state, `None` or `undefined`.
I guess the rust equivalent to what I would like to see is `nullable_var?`, and not unwrap as that will panic. That would be equivalent to the `?? throw new Error` feature mentioned further up in the comments.
Disclaimer: I am affiliated with them.