Should the comma operator be removed in D2?

KennyTM~ kennytm at gmail.com
Tue Nov 17 11:35:52 PST 2009


On Nov 18, 09 02:58, Ellery Newcomer wrote:
> KennyTM~ wrote:
>> On Nov 17, 09 23:44, Ellery Newcomer wrote:
>>> Leandro Lucarella wrote:
>>>> Ellery Newcomer, el 16 de noviembre a las 19:02 me escribiste:
>>>>> Justin Johansson wrote:
>>>>>
>>>>>> Great. Sounds like problem solved in that there is no problem.
>>>>>>
>>>>>> So how do people feel about bill's suggestion to progress the issue
>>>>>> further?
>>>>>>
>>>>>> Be good to get some comments from higher-up (Walter, Andrei)?
>>>>>>
>>>>>> Predict bearophile will chime in on this one too?
>>>>> The real problem is you'd end up with a tuple syntax identical to a
>>>>> valid c syntax. If D silently accepts it, but does something different,
>>>>> it's a no go.
>>>>
>>>> Code ported from C should not compile if the comma expression is
>>>> converted
>>>> to a tuple literal because if a and b are int, typeof(a,b) is int now
>>>> and
>>>> will be Tuple!(int, int) in the future, and I don't think
>>>> a Tuple!(anything) could be implicitly casted to anything, except,
>>>> maybe,
>>>> another tuple, but you don't have tuples in C, so there is no risk on
>>>> that.
>>>>
>>>
>>> void fun1(int a);
>>> void fun1(Tuple!(int,int) a);
>>>
>>> fun1( (a=fizbang(), a+b) );
>>
>> These are not code ported from *C*.
>
> all but the second fun1 are, and it could easily exist in D

The only guarantee I knew is code valid in C either gives the same 
result in C, or fails to compile.

Removing the 2nd fun1 which is invalid in C anyway, having a tuple 
syntax, fun1 simply fails to compile. I see no problem here.





More information about the Digitalmars-d mailing list