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

Mark smarksc at gmail.com
Sat May 9 13:19:16 UTC 2020


On Friday, 8 May 2020 at 22:20:03 UTC, Timon Gehr wrote:
> On 08.05.20 22:38, 12345swordy wrote:
>> As I am working on the "Tuples first class feature" dip (will 
>> uploaded first draft soon), I noticed that if we would allow 
>> this in D:
>> 
>> fun((int x = 10, int y = 1, int z = 2)...);
>> 
>> Could this be used as a replacement for named arguments?
>
> No, too ugly. Anyway, there should not be a difference in 
> features for tuples and multiple function arguments. In 
> mathematics, those are the same thing. (I.e. each function has 
> one parameter, which may be a tuple.) Ideally, built-in tuples 
> and multiple function arguments should interact in a way that 
> is consistent with this principle.

In mathematics you don't have function overloading. I believe 
this could cause ambiguities if tuple parameters are 
automatically "unpacked".


More information about the Digitalmars-d mailing list