Should the comma operator be removed in D2?
Ellery Newcomer
ellery-newcomer at utulsa.edu
Tue Nov 17 15:05:50 PST 2009
Ellery Newcomer wrote:
> Ellery Newcomer wrote:
>> Bill Baxter wrote:
>>> On Tue, Nov 17, 2009 at 1:51 PM, KennyTM~ <kennytm at gmail.com> wrote:
>>>> On Nov 18, 09 05:40, Ellery Newcomer wrote:
>>>>> Bill Baxter wrote:
>>>>>> However, I think for the good of humanity we can accept that one
>>>>>> little bizarre example of legal C syntax not doing the same thing in
>>>>>> D.
>>>>> int[] i;
>>>>>
>>>>> auto a = (i)[0];
>>>>>
>>>>> what does this do?
>>>> (i) should not construct a tuple. Probably (i,).
>>> That's Python's solution and it seems to work out ok.
>>>
>>> --bb
>> How do we express tuple types? Since we have tuple expression syntactic
>> support, we should have tuple type syntactic support. Cuz I'm going to
>> want stuff like
>>
>> Tuple!(int,int) [] lst;
>>
>> These won't work:
>>
>> [int,int] [] lst;
>> (int,int) [] lst; //want
>> {int,int} [] lst;
>>
>> these might:
>>
>> @(int,int) [] lst; //bleach, regardless of what symbol '@' is
>> (,int,int) [] lst; //bleach
>> alias (int,int) T; T [] lst; //bleach bleach bleach
>> int,int [] lst; //requires tuple expressions be enclosed in () hmmmm...
>
> and you'd have to enclose the types in () in nonstatement locations
which is a big bleach
>>
>> actually, types vs expressions are already syntactically ambiguous, so
>> (int,int) [] lst; doesn't lose much. It's not the kind of thing we
>> should be encouraging, though.
More information about the Digitalmars-d
mailing list