News for hackers. Stuff that matters.
Re:Rust should not have provided `unwrap` by caylus on Friday July 15, 2022 @01:15PM (#32110464)
> Well, that puts regex compilation in the same category as array indexing in my mind, and means that the default regex compilation function should panic on the user’s behalf

I like the Go stdlib idiom for this: many functions have a version with a "Must" prefix that has the behavior of panicking rather than returning an error.

e.g. for regexp: https://pkg.go.dev/regexp#MustCompile

Re:Rust should not have provided `unwrap` by masklinn on Friday July 15, 2022 @02:01PM (#32111035)
So an ad-hoc way to do the exact same thing requiring doubling the size of your api? Is your problem with unwrap that it’s too easy to find?