mustache / spec

The Mustache spec.
MIT License
364 stars 71 forks source link

Use 'if and only if' wording #60

Open andsens opened 11 years ago

andsens commented 11 years ago

I noticed that you may be able to express some of the spec in a more precise way by borrowing wording from the field of logics.

This section MUST NOT be rendered unless the data list is empty.

This sentence has a double negation which can make it a bit confusing. You can use the following wording instead and make the coupling crystal clear:

This section MUST be rendered if and only if the data list is empty.

jgonggrijp commented 10 months ago

I'm not convinced that the second wording is better. It is true that double negations are not great, but I suspect fewer people are familiar with "if and only if" than with "not unless".

andsens commented 10 months ago

Oh wow, blast from the past 🤣
I don't have any skin in the game any longer, but I'm still a staunch opponent of double negations. Additionally the bijection (i.e. if the section is rendered -> the data list is empty, and if the data list is empty -> the section is rendered) is not represented in the original. The reason I noticed it was because I reverse parsed the rendered templates in my master thesis project, where that detail was rather important :-)
May I suggest the following instead?

This section MUST be rendered only when the data list is empty.

It's the same as "if and only if", but it's more colloquial.

Anyways, closing. It's such a minor thing. I'm sure you have more important things to do, and I hardly believe that it will ever make a difference for someone.

jgonggrijp commented 10 months ago

"Not unless" means the same thing as "if and only if". "Unless" by itself is exclusive or, so the negation of it is biimplication. "Only when" does not mean the same thing; it is a reverse implication only (it misses the first part of "if and only if").

All that being said, and despite the age of the issue, you still have a point regarding the double negation. I will reopen this for the time being, in case other people want to share their opinion on it.

bobthecow commented 10 months ago

"MUST NOT unless" means "MAY if". we should change it.