I don't understand this example at all. A Rust programmer would essentially never use unwrap on the return from File::open. It would be like checking open(2) with assert() in C.
Re:Go Replaces Interface{} with 'Any'
by preseinger on Wednesday December 15, 2021 @02:43AM
(#29563120)
That Go would never pass code review unless it is part of a tiny CLI tool or script.
Unwrap would look like:
I'll take that over the current go state of the art: Just like "panic(err)" is used infrequently, "unwrap" would be used infrequently. They're comparable, and for the cases where unwrap is okay (test code, once-off scripts, etc), I'd definitely prefer it to the panic boilerplate.