Warning: Some posts on this platform may contain adult material intended for mature audiences only. Viewer discretion is advised. By clicking ‘Continue’, you confirm that you are 18 years or older and consent to viewing explicit content.
No, I want that in the std lib. Yes, it would just call x % 2 == 0 underneath. But the advantage is readability. I’m in principle aware that x % 2 == 0 is true when the number is even, but I need it seldomly enough that I do still need to think about it for a second before I know for sure. I don’t need to think about x.is_even(). And the readability is what I want natively, i.e. in the std lib.
It being in the std lib would also sidestep your concerns about security or the function call having unknown side effects.
No, I want that in the std lib. Yes, it would just call
x % 2 == 0
underneath. But the advantage is readability. I’m in principle aware thatx % 2 == 0
is true when the number is even, but I need it seldomly enough that I do still need to think about it for a second before I know for sure. I don’t need to think aboutx.is_even()
. And the readability is what I want natively, i.e. in the std lib.It being in the std lib would also sidestep your concerns about security or the function call having unknown side effects.