4 ms·
You almost never want to exploit, in a scripting language, the subtleties of the Boolean projections when writing the (un-) idiom `b = b or b_default`; it is mo
by DemocracyFTW2 3y ago
You almost never want to exploit, in a scripting language, the subtleties of the Boolean projections when writing the (un-) idiom `b = b or b_default`; it is more commonly a mistake made by script kiddies and hand-waving mavericks (i.e. People Who Finish First, a.k.a. People Who Never Write Proper Tests) that has become deeply ingrained due to the Look Ma How Clever effect. If `b` should be a Boolean with a default of `true` then `b = b or true` will quite obviously never allow it to be `false`. Rewrite that and put it in a row of such assignments as in `a = a or a_default; b = b or b_default`; c or c or c_default;` and it looses its fishy smell enough to pass as "OK, trivially no problem here".
I've indeed gotten tired by the entire idea of Boolean projections, yes, but that's not the point here, at least not almost always in practice.