DIP19: Remove comma operator from D and provision better syntactic support for tuples
Jonathan M Davis
jmdavisProg at gmx.com
Mon Sep 24 10:11:41 PDT 2012
On Sunday, September 23, 2012 16:40:34 Andrei Alexandrescu wrote:
> http://www.prowiki.org/wiki4d/wiki.cgi?LanguageDevel/DIPs/DIP19
My #1 concern here is that for loops do _not_ ever change how they function
with regards to commas (which the DIP seems to do, but it also seems to imply
that we might want to get rid of that later - which I do _not_ agree with).
The comma operator is occasionally useful beyond for loops, but it's usually
considered bad practice to do so, so if we want to get rid of it aside from
for loops, then I have no problem with that. If anything, I'd argue that
bringing tuples into the mix is muddying matters, since I think that there's a
solid argument for deprecating the comma operator based solely on the problems
that it causes even if we never add any other syntax which uses commas in a
way that the comma operator prevents.
As to whether we add tuples or not, I don't know. Being able to do something
like.
int i;
string s;
(i, s) = foo();
or
(auto i, string is) = foo();
would be useful, but I can live without it. std.typecons.tuple takes care of
most of what you need from tuples IMHO. So, if we can find a way to cleanly add
tuples to the language, I'm fine with that, but I'm also fine with leaving
tuples as they are.
- Jonathan M Davis
More information about the Digitalmars-d
mailing list