Tuple DIP

Stefan Koch uplink.coder at googlemail.com
Thu Mar 15 14:11:47 UTC 2018


On Thursday, 15 March 2018 at 14:07:12 UTC, JN wrote:
> On Friday, 12 January 2018 at 22:44:48 UTC, Timon Gehr wrote:
>> As promised [1], I have started setting up a DIP to improve 
>> tuple ergonomics in D:
>>
>> https://github.com/tgehr/DIPs/blob/tuple-syntax/DIPs/DIP1xxx-tg.md
>
> I may be out of the loop here, but what is the actual usecase 
> for tuples? What benefits does it bring? Isn't stuff like auto 
> a, b = func() less clean than using structs, e.g. FuncResult ab 
> = func() ?

For example you can have optional return-values.
And you don't introduce a dependency of the definition of a 
particular type.
Also you can write the elemets of the tuple direct into instance 
of a different type, without the need of creating a temporary.

That said, I am not sure if I would be willing to pay the 
complexity cost for it.


More information about the Digitalmars-d mailing list