templating opEquals/opCmp (e.g. for DSL/expression templates)
Nicholas Wilson
iamthewilsonator at hotmail.com
Thu Feb 14 01:46:12 UTC 2019
On Wednesday, 13 February 2019 at 21:01:46 UTC, Rubn wrote:
> On Wednesday, 13 February 2019 at 02:00:32 UTC, Nicholas Wilson
>> With opBinary doing something completely different to
>> opBinaryRight? Anyway that falls under the category of
>> deliberate abuse, something we should not be considering, if
>> people do that kind of thing then they should get what they
>> deserve.
>
> There are valid deliberate uses for this. For scalar types
> multiplication might be commutative, but for matrix
> multiplication it is not commutative.
Indeed, but you're example was with + ;). we could probably do a
python and add @ as a binary operator for that kind of thing
anyway. (# is also free)
> Which is worse in this situation? I'd argue the misnamed
> function is much more dangerous, at least if I see an operator
> being used with a custom type I know I should lookup what the
> operator means. There's also no good way to prevent poorly
> named functions.
Indeed.
More information about the Digitalmars-d
mailing list