|
|
Subscribe / Log in / New account

Code humor and inclusiveness

Code humor and inclusiveness

Posted Jun 12, 2021 16:34 UTC (Sat) by chris_se (subscriber, #99706)
In reply to: Code humor and inclusiveness by andy_shev
Parent article: Code humor and inclusiveness

> Once I have tried iff ==> if

Even in academia "iff" is not always known to everybody. If your target audience consists of mathematicians, philosophers, theoretical physicists and/or some subset of computer scientists, you may be able to use it without explanation. But even when writing a scientific paper to wider audience (fields outside of those mentioned), it is considered good form to either always expand it to "if and only if", or at the very least to define the abbreviation at it's first usage in the paper.

In code, where typos are vastly more common than scientific notation, I would always want to avoid "iff". Because either it doesn't matter that the reverse arrow is also true in that comment, and then you can just use a plain "if", or it does matter, and then "if and only if" is so much clearer to everyone.

I'd maybe think differently about this if the abbreviation for "if and only if" were some word that wasn't so close to a typo that people who didn't understand it would at least think of putting it into a search engine. For example, in German, "if and only if" is "genau dann, wenn" while a plain "if" is "wenn" -- so people sometimes use "gdw" as an abbreviation. But Germans who've never heard of "gdw" won't mistake it for a different German word, because it's not that close to anything that it could be a typo, so they'll probably put it into a search engine. People who've never heard of "iff", on the other hand, will most definitely think that it's just a typo for "if" -- native speaker or not.


to post comments

Code humor and inclusiveness

Posted Jun 13, 2021 10:26 UTC (Sun) by zauguin (subscriber, #138185) [Link]

I always seen the similarity of "iff" to "if" more as an advantage, especially when it is used carefully. I agree that when the difference really matters, "if and only if" is much cleaner, but often is doesn't matter and is more of an additional remark. Then using "iff" adds a small bit of additional context for everyone who understands it, while the important part is still perfectly readable for everyone else (even if it looks like a typo).


Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds