On Thursday, 17 May 2012 at 23:11:55 UTC, deadalnix wrote:
Le 17/05/2012 19:27, H. S. Teoh a écrit :
On Thu, May 17, 2012 at 07:20:38PM +0200, deadalnix wrote:
[...]
I think you show a real need here, but I don't really like your proposal. I'd advocate for recycling the comma operator for tuple
building.

+1.

I know the topic of comma operator has been beaten to death several times over, but I'm curious, how much is it _actually_ being used outside of for loops? Would introducing (x,y,z) tuple syntax _really_ break a lot of code? Would it even break _any_ code? -- since tuple syntax would tend to be used where you normally don't use the comma
operator.


T


I'd advocate for the following behavior :
1/ void member of tuple are computed, but not stored in the tuple.
2/ A tuple with one member can unpack automagically.

With both, I'm pretty the code broken is close to none.

To go further, I advocate for declaration to be expression. It would allow (int a, int b) = foo();

Which rox, as Andrei said :D

Can you please argument the reasons behind the need of those two rules? Do you propose void members to allow for empty and single-item tuples, as in "void" and "a,void"? And why should a single-item tuple automagically unpack instead of being unpacked with tuple[0]?

Declarations as expressions are cool! :D

Reply via email to