Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

One of my pet peeves is in there:

   DisallowTCP = false
Negating negatives is always more difficult to understand and more likely to be error prone. Why not just this, with the default being false.

   AllowTCP = true


I have the feeling that the default used to be true, and when the default was later switched to false, it was done by this option to not change the behavior of legacy configurations.


My problem is what is on the left side of the equals sign. It is already a negative ("Disallow") so the value on the right side is negated.


While I can't speak to this example specifically, in general:

The issue is what happens if the line is missing entirely?

If the default is to allow, then adding a line "allowTcp= true" hasn't actually changed your config. And deleting a line "allowTCP = true" doesn't stop allowing TCP, which could be confusing.

What the addition of the line does is actually disallow TCP.

The above is the kind of reasoning that causes configs to end up with double negatives.


The solution is very simple in my eyes - do not include a negative on the left side, and pick the default on the right side to match intentions.

These cases seem to have happened the other way around - values/meaning are picked for the right side first, which then requires contorting the left in order to match intentions.


I cannot fail to disagree with you less :p


You shouldn't not disallow no quintuple negatives neither.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: