It has been some time now since I have done any blogging, and that is a shame because we have been busy at work here in the X++ laboratory. For this brief installment I will be talking about two new operators that we have introduced, and some long overdue changes to the way that internal works.
As you may know, X++ (and most other imperative languages I can think of) have short hand operators to add and subtract values from a given variable. In other words:
X = X + 3;
Can be more succinctly expressed as
X += 3
The advantage (apart from the light syntactic sugar) is that the variable (or, more precisely, the address where the value gets stored and the value retrieved from) does not get evaluated more than once. Therefore if the expression has side effects, they are also only executed once. The X++ language has provided this short hand notation for as long as I can remember, and now we have added the multiplication and division variants:
X *= 2
X /= 2
These are short for X = X * 2 and X = X / 2.
Not a huge deal perhaps, but I thought I would mention it here, since there is no way to otherwise guess that this has become available. We do not have plans for introducing any more of these operators, like <<= and >>= (assign with shift left and shift right).
The new bits will appear in your compiler bits before you know it.

Like
Report
*This post is locked for comments