In mathematics variable = value ≡ value = variable
Re:AT&T Syntax versus Intel Syntax
by LudwigNagasena on Sunday November 13, 2022 @02:18PM
(#33586382)
That doesn’t follow. variable = value, ergo dest op src.
Indeed. Besides, “let there be light” is clearly destination-first, so this matter was already resolved by Genesis 1:3.
Which direction was the Hebrew text written in?
That is just an arbitrary notation, nothing to do with logic. In English at least, "add 4 to x" is more natural than "add to x 4".
Ergo op src dest
But English "add 4 to x" tells you nothing about where to store the result. : - )
"Add 4 to x and store result in x" vs "Let x be x + 4"?
Without any other context, you generally assume that the target is an accumulator.
So "add 4 coins to that bucket", generally means at the end of that operation the bucket contains at least four coins plus any coins that were already in the bucket.
Huh, I think my brain is not wired to think about `x` as a storage, it is closer to "add 3 to x for x = 2", which then gets reduced to "add 3 to 2" and then the destination is missing...
...math has no such order. Half the point of algebra is that the two sides of the equation are semantically equivalent and can be swapped at will.
Good luck convincing anyone that value = variable makes sense.
My math teachers had no problem with '42 = x' vs 'x = 42' as long as the steps made sense to get there. In fact they'd probably comment that there was no need to go with 'x = 42' if I obviously took a circuitous route simply to end up with x on the left side of the equation, as that would have demonstrated a lack of internalizing some of the base ideas of algebra and it's approach of equation symmetry.
Re:AT&T Syntax versus Intel Syntax
by LudwigNagasena on Sunday November 13, 2022 @10:03PM
(#33589802)
You should distinguish the meaning of = in mathematical and meta-mathematical statements. “42y = yx, therefore 42 = x” is fine; but “let 42 = x” is not.
Some older C coding styles recommend that order because before compilers added warnings, “if (17 = variable)” resulted in a diagnostic, while “if (variable = 17)” would not. Nowadays, I think most programmers prefer putting the fastest-changing expression first.
Yeah that is due to clever C semantics that that should never had allowed for anything other than boolean expressions in conditionals like proper grown languages.
And it has no state. Half the point of computation is maintaining state for the purpose of efficiency. So, computation gets an "assignment" operator where pure math lacks one, pure math being relegated to subscripts of time and indicator functions instead.
Re:AT&T Syntax versus Intel Syntax
by molticrystal on Sunday November 13, 2022 @03:19PM
(#33586914)
Postfix , infix, prefix, crucifix.
Re:AT&T Syntax versus Intel Syntax
by AnimalMuppet on Sunday November 13, 2022 @06:35PM
(#33588530)
That's just a convention. The way we would order the sentence in English is also just a convention.
You know what the logical convention to use would have been? The order that every assembler on the planet already used.
That is logic.