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

Timon Gehr timon.gehr at gmx.ch
Sat May 9 06:23:29 UTC 2020


On 09.05.20 05:03, Walter Bright wrote:
> On 5/8/2020 3:20 PM, 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.
> 
> This is already the case in D:
> 
>    fun(AliasSeq!(10,1,2))
> 
> is the same as
> 
>    fun(10,1,2)

I know that you call this a tuple, but it was renamed in Phobos.
This thread is about first-class language support for something like 
std.typecons.Tuple.



More information about the Digitalmars-d mailing list