Originally Posted by Seerah
I think it is, too. And it doesn't save on anything other than space.
|
Not quite true -- it's applicable to other languages that don't have a ternary syntax (or at least a sensible one) like Python. Also, even for languages that do have some kind of (sensible) ternary syntax, "not not X" or "!!X" looks and works pretty much the same way in every language where it works at all, meaning you have to shift fewer gears when you move between a Lua project and a project in another language. Even if I found "not not X" harder to follow at first glance than "X and true or false", I'd still favor "not not X" for that reason.
Plus, when I see "not not X" there's only one possible intention -- to typecast to a boolean. When I see "X and A or B" there are a lot of possibilities, and I find it's more mental effort to read.