Tuples a first class feature, manu's new unary operator and named arguments

Mark smarksc at gmail.com
Sat May 9 17:07:02 UTC 2020


On Saturday, 9 May 2020 at 14:28:37 UTC, Timon Gehr wrote:
> On 09.05.20 15:19, Mark wrote:
>> In mathematics you don't have function overloading. I believe 
>> this could cause ambiguities if tuple parameters are 
>> automatically "unpacked".
>
> You can easily have function overloading and fully sane tuple 
> semantics at the same time. It is true that in D, some 
> compromises might have to be made in order to preserve 
> backwards compatibility. I think my attempt [1] [2] does that 
> quite well, but maybe there is an even better way.
>
>
>
> [1] 
> https://github.com/tgehr/DIPs/blob/tuple-syntax/DIPs/DIP1xxx-tg.md (Proposal 2)
> [2] 
> https://github.com/dlang/dmd/compare/master...tgehr:tuple-syntax

Personally, I like how Python does it - you have to unpack tuples 
manually but the syntax is extremely terse (*mytuple). It also 
supports "dictionary unpacking", which allows passing named 
parameters to functions elegantly, again with very little 
syntactic overhead (**mydict).


More information about the Digitalmars-d mailing list