Boolean blindness is real. When you have a function like `is_valid?` you would most likely rather have a fun that return :valid | {:invalid, reasons}, where reasons is a list explaining why the data is not valid. Sometimes a bool is the right return but not often. #myelixirstatus
-
-
Replying to @gausby
Except that this inevitably leads to people writing ‘if is_valid?(token) do ...’ and then wondering how the bad guys keep getting in
3 replies 0 retweets 2 likes -
Obviously, question-mark functions are only for boolean results.
1 reply 0 retweets 0 likes -
Without doubt. And my original tweet does not claim or argue otherwise.
1 reply 0 retweets 0 likes -
Right, my reply was more about the dangers of boolean coercion, which might bite people regardless of function name. Use ‘case’ even for boolean returns and let it crash if you made incorrect assumptions
1 reply 0 retweets 0 likes
IF considered harmful
6:22 AM - 30 May 2019
0 replies
0 retweets
1 like
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.