Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In C++, functions are error-colored by default. You write "noexcept" if you want your function to be infallible-colored instead.

(You usually want to make a function infallible if you're using your noexcept function as part of a cleanup path or part of a container interface that allows for more optimizations of it knows certain container operations are infallible.)

Rust makes infallibility the syntactic default and makes you write Result to indicate fallibility. People often don't want to color their functions this way. Guess what happens when a programmer is six levels deep in infallible-colored function calls and does something that can fail.

.unwrap()

Guess what, in Rust, is fallible?

Mutex acquire.

Guess what you need to do often on infallible cleanup paths?

Mutex acquire.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: