Should we deprecate comma?
Kenji Hara
k.hara.pg at gmail.com
Sun Mar 23 18:27:52 PDT 2014
2014-03-24 10:09 GMT+09:00 bearophile <bearophileHUGS at lycos.com>:
> Andrei Alexandrescu:
>
> Discuss: https://github.com/D-Programming-Language/dmd/pull/3399
>>
>
> Regarding the "progress", I'd like a good built-in syntax to unpack tuples
> in assignments, inside function signatures, in foreach statements, and
> more, because the syntactic contortions I currently adopt to use tuples in
> D are bad.
>
I'm partially against to it.
1. I think removing comma operator does not have useful effect for tuple
syntax discussion. For example:
1a. If you want to use parenthesis syntax (...) for tuple, we should
resolve one-element tuple ambiguity first.
(exp) // one-element tuple, or just an expression ?
And, removing comma operator does not resolve this issue.
1b. If you choose other syntax for tuple, comma operator will be no
longer related to tuple syntax discussion.
{exp, exp2} // eg. using brace for tuple syntax no longer touch to
comma operator
2. Indeed in some case comma operator is bug-prone, but if it is used
directly on the ExpStatement, it's still useful to me.
foreach (e; exp1, exp2) {} // maybe bug?
if (cond) exp1, exp2; // in most case, this is not a bug.
So, completely removing comma operator will cause negative affect in
some cases.
Kenji Hara
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20140324/a5eca7c5/attachment.html>
More information about the Digitalmars-d
mailing list