On Sunday, 23 September 2012 at 20:57:48 UTC, foobar wrote:
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 assign
the value of the expression.
for (int i, j; cond; i++, j++) {}
I'd suggest looking at functional implementations such as ML or
Haskel for more inspiration.