As a programmer, when you call a function (or procedure or method or other piece of code), you should always check that it succeeded and if not, handle the error.

This is easy to get wrong.

A quality of a programming language is how easy it is to overlook handling of an error.

Good: Rust Result values; Python exceptions.

Bad: Unix system call integer codes; C functions that return NULL for error; shell scripts that invoke commands that can fail.

(Any command can fail.)

@liw Yes, Rust's result/Error system is very neat, and although perhaps not intuitive at first,, the way that it chains together with else/or/and's in various places is very flexible.

Follow

@penguin42 @liw The tool that makes the difference between a normal value for Rust's Result values is the unused_must_use warning that is enabled by default. Maybe having something like this in C would be nice, but it would be much more difficult to implement in a compiler because of all the different ways errors might be signalled.

Sign in to participate in the conversation
Fosstodon

Fosstodon is an English speaking Mastodon instance that is open to anyone who is interested in technology; particularly free & open source software.