We’re all familiar with the pre- and post-increment operators, e.g.
c++; // c = c + 1 ++c; // ditto
and the ‘combined operators’ which extend this principle:
c += 5; // c = c + 5 s .= ', world'; // s = s . ', world'; e.g. PHP
I’ve often had a need for a ‘post-combined operator’, which would allow:
s =. 'Hello '; // s = 'Hello ' . s
Obviously, this is only really useful with non-commutable operators and the meaning is altered from pre-/post-increment, even though the syntax is borrowed.
Are you aware of any language that offers such an operator, and why isn’t it more common?
A basic objection to the example as-given is that it’d create ambiguity:
Edit: But no, I’m not aware of any languages that use them. Presumably this is because they were omitted from C from whence most other languages derive their basic operators.
And yeah, I’d love to see them in the languages I use.