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

Because the very raison d'etre of asserts is to be a compile time/test time check. If you wanted them to run in production, you wouldn't use an assert, you would just run an if. Otherwise what's an assert to you? A mildly convenient sugar syntax alternative to if statements?


That a semantic we've all just sort of inherited from C - I don't know we're required to be bound by it forever. The word itself doesn't imply that assertions would be contextually disabled.


semantics are as if not more important than the technical execution. Bits are all abstractions anyways, what's important is the meaning we assign to them.


right, it is just syntactic sugar, but if that wasn't helpful then why have it in dev either? I find it more confusing to have asserts be stripped, which creates an implicit dev/prod discrepancy


> A mildly convenient sugar syntax alternative to if statements?

Yup.




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

Search: