Comma expression as tuple operator [was Tuples, C#, Java, languagedesign]
Joel C. Salomon
joelcsalomon at gmail.com
Wed Dec 30 18:30:14 PST 2009
On 12/30/2009 12:38 AM, BCS wrote:
> Hello grauzone,
>> Why not make the programmer write tuple[$-1] instead?
>>
>> i = (j += i, i*2 + j)[$-1];
>>
>> There's no reason to keep the current comma operator.
>
> Frankly, while I have no problem with it, I'd also be fine with dumping
> the comma operator all together, even making the [$-1] thing illegal
> ("code has no effect" and all that) but Walter has time and again shot
> down anything that does away with the comma operator so I was looking at
> it as a way to have my cake and eat it to.
Can the comma operator be given a different symbol to use? How about,
e.g., a double comma:
auto i = 1, 2; // tuple
auto j = 1,,2; // sequence operator
—Joel
More information about the Digitalmars-d
mailing list