DIP19: Remove comma operator from D and provision better syntactic support for tuples

foobar foo at bar.com
Sun Sep 23 13:58:43 PDT 2012


On Sunday, 23 September 2012 at 20:39:38 UTC, Andrei Alexandrescu 
wrote:
> I discussed this with Walter, and we concluded that we could 
> deprecate the comma operator if it helps tuples. So I started 
> with this:
>
> http://www.prowiki.org/wiki4d/wiki.cgi?LanguageDevel/DIPs/DIP19
>
> Unfortunately, I started much cockier than I ended. The 
> analysis in there fails to construct a case even half strong 
> that deprecating the comma operator could significantly help 
> tuples. Well it essentially concludes that tuples are mostly 
> fine as they are, and attempts to embellish them syntactically 
> are marred with unexpected problems. Nevertheless, I sure have 
> missed aspects all over, so contributions are appreciated.
>
>
> Thanks,
>
> Andrei


Yay! vote += infinity

Regarding specifics,
I'd argue that (int) should be a perfectly valid construct. I 
don't see what's confusing about that. I also am opposed to the 
idea to limit tuples to 2 or more elements. On the contrary, I 
root for the clean semantics of having a proper unit type 
represented as () instead of the horrible C semantics of the 
'void' type. Just make void an alias to () for backwards 
compatibility.
Also, why the need to special case the for loop? the increment 
part can be a regular tuple since the for loop doesn't
for (int i, j; cond; i++, j++) {}


More information about the Digitalmars-d mailing list