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

I would say, sure, if you feel the same way about panic calls making to production. In other words, review all of them the same way. Because writing unwrap/expect is exactly the same as writing “if error, panic”.


I don't understand your point: panic! is akin to expect: you think about it consciously, use it explicitly and you write down a panic message explaining its rational.

unwrap isn't like that.


It should be. If you aren’t treating it exactly the same as panic and expect, that’s what I’m calling the “blind spot”. And why should you have to make up a message every time when the backtrace is going to tell you what was wrong?


> And why should you have to make up a message every time when the backtrace is going to tell you what was wrong?

The message isn't really here to be displayed during a crash (since the crash should never happen in the first place), it's here to communicate the invariant in the code, to the developer reading and modifying it later on.




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

Search: