Hacker News new | ask | show | jobs
by morgante 4570 days ago
Sorry, but I just don't see what was unclear about the original conditional. Anyone with a basic grasp of logic could parse it instantly.

As for the refactoring, that might be a good choice (I myself prefer positive boolean methods) but it's not a logic lesson.

2 comments

I don't not agree, it was perfectly not unclear at all.
I see the double negative in code the same as it is in English (and probably any verbal language). Even though I can understand the first version of this code, for me second version can be understood much faster. The lesson I gathered is one that's already taught in verbal languages: double negatives should not be used (or used sparingly).
Actually, double negatives are the norm in natural languages. Prescriptive "standard" English is weird in that there's a notion that there's a sort of algebraic multiplication of negatives/negators. As in most non-standard English dialects, a construct shaped like "I haven't done nothing" usually means exactly the same as "I haven't done anything" in most languages (and the double-negative version is usually considered to be more proper or more elegant). Yes, there is a way of looking at things that says we have gained some precision of language by the artificial imposition of a lot of the "rules" of English imposed (primarily and almost exclusively) by self-declared experts in the late seventeenth and eighteenth centuries, but there is no evidence that many of the rules that are more commonly broken than followed in vernacular English ever exited before Lowth, Murray and a handful of their contemporaries told us that they knew what was best for us.