View Single Post
11-17-16, 11:39 PM   #37
Phanx
Cat.
 
Phanx's Avatar
AddOn Author - Click to view addons
Join Date: Mar 2006
Posts: 5,617
Originally Posted by Seerah View Post
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.
__________________
Retired author of too many addons.
Message me if you're interested in taking over one of my addons.
Don’t message me about addon bugs or programming questions.
  Reply With Quote