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

As a gopher I never understand why is there so many unwraps in an average rust code.

Average Go code has much less panics than Rust has unwraps, which are functionally equivalent.





The average golang code segfaults by design.

I love Go and write a ton of it. I've had real segfaults quite a lot.

Because Go silently gives you zero/null instead

Idiomatically, it gives you `err` and you do `if err != nil {return err}`. While in rust you mostly do `.unwrap` and panic.

It's not in the type system, but it's idiomatic


Get a key from a map and forget to check the error.

which mean an unexpected behavior could go unnoticed for a long time.

I'd prefer a loud crash over that.


Well look at the failure modes in the original article.

In the original PHP code, all worked, only it didn't properly check for bots.

The new Rust code did a loud crash and took off half of the internet.




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

Search: