This is where I shake off the cobwebs and ancient dust and lost memories from my childhood to point out that I somehow still know that << is the insertion operator. It does more than just write, and it can write to more than just the standard output stream.
https://www.cplusplus.com/reference/ostream/ostream/operator...
It's an overload for the left shift operator, and keeps the natural precedence of this operator (slightly lower than addition and subtraction) which leads to occasional surprises because something like:
out << x == y;
... is actually outputing x, and then comparing y to the out stream not to x, and then throwing away the result, even though that's clearly not what anybody intended.
I agree that programming languages, it can mean various things, just like < and > mean different things in C++ vs bash vs drawing arrows.
Context matters.
https://www.youtube.com/watch?v=gi_6SaqVQSw
Still you probably don't want opportunities for confusion when dealing with machines. What you are sure is obvious may not be obvious at all to the machine and it needn't care what you thought you meant.
a := 3
...
a := 4
This is valid: a := 3
...
a = 4
As is this: a := 3
...
a, b := 4, 2
And this is an error again: a := 3
b := 4
a, b := 1, 2
Since neither a nor b are new variables.The multi-variable case is trickier, especially because (result, err) is such a common pattern and you neither want to impede the very common case of storing a result into a new variable nor to require a profusion of differently-named variables for errors that are very likely to just get folded anyway. So it allows it if any of the variables are new rather than requiring all. But clearing a large chunk of the bug surface is still much better than not.
(This is only my extrapolated reasoning, of course.)
In the bash scripting language '>>' means 'append to the named file' as in:
In C, '>>' means 'shift the value right by one bit' while '<<' means 'shift the value left'. However, in C++, '<<' can also mean 'write to standard output'.No confusion at all possible, ya think?