Comma expression as tuple operator [was Tuples, C#, Java, languagedesign]

retard re at tard.com.invalid
Thu Dec 31 00:11:29 PST 2009


Wed, 30 Dec 2009 21:30:14 -0500, Joel C. Salomon wrote:

> 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

Wouldn't that break the C compatibility?



More information about the Digitalmars-d mailing list