Discussion Thread: DIP 1037--Add Unary Operator ...--Community Review Round 1
Ola Fosheim Grøstad
ola.fosheim.grostad at gmail.com
Wed Oct 28 15:43:24 UTC 2020
On Wednesday, 28 October 2020 at 15:30:28 UTC, Paul Backus wrote:
> Generic code can deal with this the same way
> std.algorithm.reduce does: by taking the initial value as a
> parameter, or by requiring that the tuple be non-empty.
What I meant is what if the library author provided a function
for "numbers", but never tested the code with floats. If the
initial value is required then the library author would have
remembered to set the initial value to "cast(T)0" for addition or
"cast(T)1" for multiplication.
More information about the Digitalmars-d
mailing list