I dun a DIP, possibly the best DIP ever
Walter Bright
newshound2 at digitalmars.com
Fri Apr 24 20:15:43 UTC 2020
On 4/24/2020 1:34 AM, Manu wrote:
> On Fri, Apr 24, 2020 at 6:20 PM Walter Bright via Digitalmars-d
> <digitalmars-d at puremagic.com <mailto:digitalmars-d at puremagic.com>> wrote:
>
> On 4/24/2020 12:39 AM, Manu wrote:
> > It doesn't make much sense to think in terms of primitive types. As I
> just said
> > (but you truncated), operator overloads are almost certainly part of this
> equation.
>
> Operator overloads don't change it.
>
>
> This claim doesn't make sense. A custom type can BinOp any adjacent type it likes.
I can't see the legitimate use case for:
((t[0] + t[1]) + t[2])
for a tuple if relying on diverse types with operator overloading, because of
the associative ordering dependency.
If anyone relied on that, it would be a major code smell. Adding new syntax for
tuples to support that would be a mistake.
> > I think it's more common to do a fold like this with logical operators
> though;
> > `&&` appears 9 times out of 10 in my code.
>
> [ cast(bool)Tup ]
>
> And then fold them?
Since then it's an array, use the existing array folding methods.
More information about the Digitalmars-d
mailing list