Multiple return values...
Timon Gehr
timon.gehr at gmx.ch
Fri Mar 9 16:10:35 PST 2012
On 03/10/2012 01:00 AM, Manu wrote:
> On 10 March 2012 01:17, Timon Gehr <timon.gehr at gmx.ch
> <mailto:timon.gehr at gmx.ch>> wrote:
>
> On 03/10/2012 12:02 AM, Manfred Nowak wrote:
>
> Manu wrote:
>
> I'm just talking about the ABI for returning multiple
> values, not
> chaining
>
>
> Does this mean, that you want a special type of "function"? For
> example
> this would be disallowed statement: `auto result= f( g(
> parameters));',
> if `f' and `g' are functions returning multiple values?
>
>
> This needs to work. Multiple return values should integrate with the
> existing language support for tuples.
>
>
> What should that do exactly? A function that returns multiple values is
> passed as an argument to another function... what exactly is fed to
> which arguments of the outer function?
It would work like built-in tuples already do.
(int, int) foo(int a, int b){return (a,b);}
assert(foo(foo(foo(foo(1,2))))==(1,2));
(int, int) goo(int a, int b, int c){return (a+b, c);}
assert(goo(foo(2,3),1) == (5,1));
> Describe how you see multiple return values working through tuples,
> while satisfying the issues I raise in my first couple of posts?
I have done so in my other post, you may refer to that one if something
is still unclear: http://forum.dlang.org/post/jjdhdk$16v3$1@digitalmars.com
More information about the Digitalmars-d
mailing list