Why not allow elementwise operations on tuples?

JG someone at simewhere.com
Wed Jan 18 16:42:00 UTC 2023


On Monday, 16 January 2023 at 08:30:15 UTC, Sergei Nosov wrote:
> On Friday, 13 January 2023 at 15:27:26 UTC, H. S. Teoh wrote:
>> [...]
>
> Yeah, that's clear that such an implementation is rather 
> straightforward. Although, I'm a bit confused with your 
> implementation - 1. it doesn't seem to use tuples behind the 
> scenes despite your claim (it uses static array) 2. `alias impl 
> this;` introduces some unexpected interactions (e.g. `~` and 
> `toString` are "intercepted" by the array implementation and 
> yield "wrong" results).
>
> Anyway, my original question was primarily about reasoning - 
> why there's no implementation specifically for `std.Tuple`? If 
> it's a "feature, not a bug" - what's the best way to provide an 
> implementation on the client side?

I guess such a method wouldn't be particularly generic since a 
tuple does not need to consist of types that have the same 
operations e.g. Tuple!(int,string) etc


More information about the Digitalmars-d-learn mailing list