Re:I want off Mr. Golang’s Wild Ride (2020)
by Ar-Curunir on Friday April 29, 2022 @12:59AM
(#31201616)
Null pointer bugs are prevented by idiomatic use of Option in Rust, so that’s at least one case where Rust’s focus on correctness prevents memory-safety bugs.
[ Parent
| on HN ]
Re:I want off Mr. Golang’s Wild Ride (2020)
by yencabulator on Friday April 29, 2022 @12:07PM
(#31206990)
Yet many Rust code bases are littered with .unwrap(), which undoes that benefit.
Re:I want off Mr. Golang’s Wild Ride (2020)
by Freaky on Saturday April 30, 2022 @08:54AM
(#31215682)
A great deal of the benefit of Option comes from where it isn't used - you know most things can't be null and simply don't have to think about the possibility.
unwrap() bugs are annoying, yes, but at the end of the day they're just a fancy assert(), helpfully spelled out in the code and confined to bits of it where the value is Option<T>. This is a much better situation than a language where nulls can in principle turn up anywhere.
Re:I want off Mr. Golang’s Wild Ride (2020)
by Ar-Curunir on Friday April 29, 2022 @01:12PM
(#31207908)
but it's explicit; you can easily tell which lines of code will panic.