Parquery/gocontracts

Don't panic, return early

elimisteve opened this issue · 1 comments

Calling a panic is a no-no and will cause programs to blow up.

Also, unfortunately these checks will slow down programs, but I personally think it's worth it.

Hi @elimisteve,
Thanks for raising the issue!

Contracts (as in design-by-contract, not go2 feature) are meant for program correctness, not input validation. When a contract is violated, the program should actually blow up (signalling undefined behavior and a bug) rather than continue to run.

As far as I understood go panics, they are the right tool: https://gobyexample.com/panic

Please re-open if I misunderstood your issue.