Hacker News new | ask | show | jobs
by caylus 1429 days ago
> 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

1 comments

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?