logoalt Hacker News

benj111today at 10:20 AM0 repliesview on HN

I think part of the problem is that assert is used for different things.

You can use assert to cover a case that should never happen, you can also use assert to catch programming errors during development.

It's arguable that you don't want the second group in a production build. That should have been caught in testing.

But then there's the use where it's a lazy person's if statement. Instead of dealing with the issue assert it. I'm undecided whether this is a net good. Would the test have been implemented anyway?