Should we deprecate comma?
Andrei Alexandrescu
SeeWebsiteForEmail at erdani.org
Mon Mar 24 09:40:29 PDT 2014
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
More information about the Digitalmars-d
mailing list