SQLite Forum

Doc: Lack of punctuation leads to confusion
Login

Doc: Lack of punctuation leads to confusion

(1) By Harald Hanche-Olsen (hanche) on 2022-01-27 21:42:38 [link] [source]

In the page on data types, section 3.2. Affinity Of Expressions, first bullet point:

The right-hand operand of an IN or NOT IN operator has no affinity if the operand is a list and has the same affinity as the affinity of the result set expression if the operand is a SELECT.
[my boldface]

That sentence needs at least a comma after the words “is a list”.

I had to read this several times to make sense of it, because when I arrived at “is a list and” my brain figured out that there are two criteria to be fulfilled for the expression to have no affinity, namely (a) it is a list, and (b) it has the same affinity as … oh wait, if it has affinity, then it supposed not to have affinity? Makes no sense. Backtrack and read it again. Nope, that is what it says. So I read the rest of the sentence, and realise that I am looking at two different statements. Once confusion has set in, it can be amazingly difficult to get unconfused sometimes.

I suggest making it two sentences:

The right-hand operand of an IN or NOT IN operator has no affinity if the operand is a list. It has the same affinity as the affinity of the result set expression if the operand is a SELECT.

(2) By Ryan Smith (cuz) on 2022-01-27 22:40:40 in reply to 1 [source]

Had a chuckle on this observation - reminded me of the old programmer joke:

You know your partner is a programmer when...
You write in the shopping list: "Bring 2 loaves of bread, and if they have eggs, bring a dozen.", to then find the diligently returned shopping basket contains 12 loaves.

As to the suggested change, I would even go so far as to prefer the sentences to read:

The right-hand operand of an IN or NOT IN operator has no affinity if the operand is a list. If the operand is a SELECT, it has the same affinity as the result-set expression.

But that is the most minor nit and any clear statement would honestly be fine.

(3) By Larry Brasfield (larrybr) on 2022-01-28 13:38:53 in reply to 1 [link] [source]

Thanks for the pickup.

This edit should resolve both the English ambiguity and need for rereading that sentence. The ambiguity can be resolved by semantic analysis, and by knowing what needed to be said, but we prefer that readers not have to go to such lengths.