Re:Rust in Android: move fast and fix things
by ikety on Thursday November 13, 2025 @05:54PM
(#45921803)
Yep Rust approach won. Pretty much every new language is adopting Result style errors and it's been adapted to plenty of existing languages.
It's a product of functional programming, and for me I can't see how you would ever want to handle errors outside of the functional programming railway-oriented style. For me it's just superior.
Re:Rust in Android: move fast and fix things
by tczMUFlmoNk on Friday November 14, 2025 @12:54AM
(#45924268)
Umm, actually, it's specifically a coproduct of functional programming. ;-)
Re:Rust in Android: move fast and fix things
by ikety on Friday November 14, 2025 @09:47AM
(#45927226)
Ha learned something
Re:Rust in Android: move fast and fix things
by Mond_ on Thursday November 13, 2025 @06:19PM
(#45922013)
Pet peeves nitpick: it's not even a tuple. Go doesn't have tuples. It just has special-cased "multiple return values", which means that it's often impossible to just stuff the return of a function call (error value and all) into any data structure to aggregate them. You just can't do without first defining a struct since tuples don't exist in Go.
Go get this completely wrong! It use a tuple rather than an enum for potential errors. This means you can forget to check errors and just use the invalid (nil?) return value from the function.
On the other hand, rust uses the Either enum to force you to handle the error. Alternatively you can use the ? operator to pass it to the calling function, which is reflected in the enclosing function's type.