Quite likely one of the absolute worst habits programmers have inherited from C and C++ is the obsession with typing less at the expense of clarity and solid syntax.
This isn’t about C/C++ or any other language. The proposed operator and its syntax are dictated solely by the clarity and readability of the swap operation itself. And in my opinion, there simply isn’t a simpler syntax for swapping that would fit so well with the current Pascal syntax.
So this isn’t some obsession with limiting the number of characters to be written, but rather a proposal driven by the desire to increase the verbosity of the swap operation. And this would be achieved through an explicitly separate operator, rather than the complicated and lengthy syntax of tuples. A separate operator makes even more sense because tuples can be disabled, making their syntax for performing a swap unavailable.
Besides, of course, having less code to write to express a given operation is always a disadvantage. Pascal itself has many such shorthands, and the unleashed dialect has even more. If you don’t like the new operator, that’s fine, but don’t be hypocrites.
At least the alternative gives a hint as to what the statement does.
And how long will it take to analyze and understand the meaning of such a highly complex expression?
Typing a few more characters ?... not everyone out there is a one-and-a-half fingers typist.
Not just a few, but even dozens more characters—not everyone out there uses single-letter-identifiers (actually most of Pascal programmers don't use them as this is a very bad practice). I gave you an example of swapping field values between two records (practical use, from my game source code) and this ridiculous tuple syntax produces expression wider that half of my entire monitor screen—very long, hard to read, hard to understand.
And it’s not just about the extra characters to type, but also the number of places where a mistake can be made (the same pairs of variables on both sides, their order reversed) which, in the case of a separate operator, simply do not exist. To me, it’s ridiculous that no one seems to see the absurdity of the alternative syntax.
It takes a lot longer to figure out, by finding and searching the manual, that :=: means swap than the time it takes to type a few more characters that makes the intent clearer for anyone who reads the statement.
That’s simply not true; it’s just gaslighting, an attempt to make me believe that black is white. A short expression, as short and simple as an ordinary assignment, with an explicit separate operator having only one specific meaning, requires no analysis at all, only knowledge of the existence and purpose of that operator. Knowledge of the operators available in the language is an absolutely fundamental skill for a programmer.
You see the
:=: operator and immediately know it’s a swap, and you see it right away because it’s the second token in a three-token expression, not enclosed in any parentheses. But when you see tuple syntax, you won’t know if it’s a swap until you analyze the entire, long, and complex expression, comparing the variables in the left tuple with those in the right tuple and the order in which they’re listed. Besides, the syntax of tuples isn’t clear enough to immediately know that using it for a swap is valid, so you’ll have to consult the documentation anyway to be sure.
Besides, as I mentioned earlier, tuples can be disabled via a directive, in which case the swap option will not be available at all. That’s why a separate operator comes out on top once again.