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

> The Rust is interesting, for sure, but I don't know what "?" is doing.

But it’s very easy to wrap one’s head around it. If the code under question mark returns an error, the function within which that code sits returns early with that error. If that function returns Result<T>, the question mark essentially provides short, composable code.

I never personally had a problem with Go error handling but having prior experience with scala where I often used Try(…).toEither, I love Rust’s ?.



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

Search: