Casting by assigning to the right ...
Manfred Nowak
svv1999 at hotmail.com
Tue Apr 14 21:45:22 UTC 2020
On Tuesday, 14 April 2020 at 13:03:19 UTC, aliak wrote:
> Also, you can make it a generic free function if you want.
[...]
> i.castAssign(s); // cast and assign s
And because the pair of parenthesis can by exchanged by a `=',
giving
`i .castAssign= s;'
you just evaluated, that there is in addition to {+, -, *, /, %,
^^, &, |, ^, <<, >>, >>>, ~} an additional bunch of ops for the
op-assignment-operator giving the resulting form in regular
language parlor:
'.' ident '='
Allowing ident to be an empty string would even include `.=' to
be recognized as an assignment operator. This is very close to
the assignment operator in pascal `:='.
What is the better annotation of a coder knowing, that a cast is
being executed under the hood: `._=' or `:='?
More information about the Digitalmars-d
mailing list