AliasTuples, rather than Records, to return multiple values

deadalnix deadalnix at gmail.com
Thu May 17 16:18:44 PDT 2012


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


More information about the Digitalmars-d mailing list