| |
 | Posted by Quirin Schroll in reply to Basile B. | Permalink Reply |
|
Quirin Schroll 
Posted in reply to Basile B.
| On Monday, 30 December 2024 at 21:33:58 UTC, Basile B. wrote:
> If you look long enough at some code you'll see patterns like
a = a.b;
this pattern strangely looks like binary assignment operators
a = a + b;
which can be rewritten as
a += b;
In the same fashion we could have
a .= b;
The point is to evaluate te left hand side only once.
It will fool newcomers into thinking . is a binary operator, but it’s not. The right-hand side cannot ever be something other than an Identifier followed by something. I don’t think I have ever seen someone put spaces around . exactly because of that.
|