Tuple DIP

Seb seb at wilzba.ch
Thu Mar 15 14:51:49 UTC 2018


On Thursday, 15 March 2018 at 14:11:47 UTC, Stefan Koch wrote:
> 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.

Tuples was by far the most missed language feature in the "State 
of D" survey:

https://rawgit.com/wilzbach/state-of-d/master/report.html#180373345

(50% of all respondents mentioned tuples as a language feature 
they miss in D.)


More information about the Digitalmars-d mailing list