points by ethin 3 days ago | 0 comments
Rust would not save you here as this is a logic bug. Nor would, well, really any other language. I suppose someone might claim that Rust's result type would save you but it really wouldn't: I can easily make the error type a String or pretty much any other type with little consequence.
[–] K0nserv 3 days ago
[–] iknowstuff 3 days ago
It would, due to Result<T> and #[must_use] on it. Nobody would return “*” as a sentinel in Rust.
[–] slopinthebag 2 days ago
languages with more features would mean developers aren't choosing between unchecked NULLs or sentinel strings.
@my-huge-pony does make a good point elsewhere in the thread: if the potential error was not foreseen and the code was written originally to return `String` instead of `Result<String, Error>` then even Rust would be in a pickle.