Casting by assigning to the right ...
aliak
something at something.com
Wed Apr 15 07:44:23 UTC 2020
On Tuesday, 14 April 2020 at 21:45:22 UTC, Manfred Nowak wrote:
> 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 `:='?
I don't think either of those tell me about a cast happening.
Maaaaaybe .cast= but I'm not sure and it feels weird.
More information about the Digitalmars-d
mailing list