Should we deprecate comma?
w0rp
devw0rp at gmail.com
Mon Mar 24 11:26:34 PDT 2014
On Monday, 24 March 2014 at 16:40:29 UTC, Andrei Alexandrescu
wrote:
> On 3/24/14, 5:25 AM, w0rp wrote:
>> Please kill the comma operator with fire. Is is just bad.
>>
>> On Monday, 24 March 2014 at 12:20:11 UTC, Marc Schütz wrote:
>>> Or, if you really want to distinguish them, this would work:
>>>
>>> (1,2) two-element tuple
>>> (1,) one-element tuple
>>> (1) simple expression
>>> (,) empty tuple
>>
>> I am a regular Python user, and I advise against using this
>> syntax for
>> tuples. I have been bitten many times by something which I
>> thought was a
>> tuple becoming an expression and something I thought was a
>> simple
>> expression becoming a tuple. It may be less of an issue in a
>> static
>> language, but it will still be an issue. I don't have an
>> alternative
>> syntax to propose.
>
> How about
>
> tuple(1,2) two-element tuple
> tuple(1) one-element tuple
> (1) simple expression
> tuple() empty tuple
>
> Oh, wait...
>
>
> Andrei
Yes, I am with you on this. I prefer tuple(1) over (1, )
More information about the Digitalmars-d
mailing list