Hacker News new | ask | show | jobs
by AJRF 2460 days ago
Why not use `if let` instead? Way safer
1 comments

The issue I'm talking about is what to do when you don't have a good idea of what to put in the "else" branch.
A usrful error message?
This isn't always possible.
Why not? I always fold or map my option types. Sometimes I return None and caller handles it, sometimes I print a useful and informative error message. One should never ever directly unwrap an option value. In fact, some languages and libraries simply don’t allow it.