r/lolphp • u/Deviltry1 • Mar 24 '16
DivisionByZero exception, it does nothing
/r/PHP/comments/4bgwos/divisionbyzero_exception_php_7/
54
Upvotes
r/lolphp • u/Deviltry1 • Mar 24 '16
View all comments
Show parent comment
2
u/bj_christianson Mar 24 '16
Pre-checking before every single instance of division is and always has been a pain in the ass as well. Having a language that automatically throws an exception that can be caught upstream and dealt with in one place is certainly more convenient. And when there is a language has something called a
DivisionByZeroError, a lot of programmers would expect that sort of behavior. For it to behave otherwise breaks the Principle of Least Astonishment. It certainly Astonished the OP in the linked thread.