Should we deprecate comma?

bearophile bearophileHUGS at lycos.com
Mon Mar 24 05:44:21 PDT 2014


w0rp:

> 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.

I agree, 1-tuples in Python are tricky. Compare it with the clear 
Python list literal syntax:

[]        => 0-length list
[1]       => 1-length list
[1, 2]    => 2-length list
[1, 2, 3] => 2-length list

Unfortunately ASCII offers a limited choice of delimiters :-)


> I don't have an alternative syntax to propose.

Look at some of the syntaxes here:
http://wiki.dlang.org/DIP32#Use_case_of_uniform_tuple_syntax

One of the syntaxes:

@{}
@{a}
@{a, b}
@{a, b, c}

Bye,
bearophile


More information about the Digitalmars-d mailing list