opConcatAll?
Ali Çehreli
acehreli at yahoo.com
Fri Jul 3 19:06:21 UTC 2020
On 7/2/20 12:28 PM, Nick Treleaven wrote:
> Sounds good, although I think multiple other operations beside
> concatenation could benefit from being intercepted:
>
> opNary(string op, T...)(T args)
Given the confusions raised elsewhere in this thread, I think that
syntax gives the biggest benefit; defined for a single operator. And we
don't even need a new keyword:
opBinary(string op, T...)(T args)
which would solve Steve's original issue. Of course, doing the expected
thing and the associativity issue would still be left to the
implementer. For example, in order to stay consistent with the rest of
the type system, the programmer should handle b and c before a below
because ^^ is right-associative:
a ^^ b ^^ c
Well, we have to trust the programmer anyway.
So, I propose an extension to opBinary to optionally take multiple
arguments.
Ali
More information about the Digitalmars-d
mailing list