Hacker News new | ask | show | jobs
by charlieo88 2262 days ago
Beautiful!

I once tried using ternary to explain to a semi-retired mainframe programmer how we wanted to modify a binary field to have more than two choices. He was so mad and insisted you can't just MAKE UP MATH when explaining your project goals. This project would have made his head explode.

1 comments

I do think a set/enum is a better structure than a ternary field for T/F/null. Even if you defined the elements of the set to be { TRUE, FALSE, NULL }. Because, I believe, most of us see a field containing a T/F and assume it's a binary, not ternary field. Even if someone notices that the field is null-able, they might assume it's a mistake.

Unless you've been burned by that before and remember to check those assumptions.

I prefer having a nullable version of other types so it has to be explicitly wrapped. bool vs nullable(bool)