Multiple return values...

Timon Gehr timon.gehr at gmx.ch
Sun Mar 11 05:52:54 PDT 2012


On 03/11/2012 01:30 PM, Manu wrote:
> On 11 March 2012 05:04, Andrei Alexandrescu
> <SeeWebsiteForEmail at erdani.org <mailto:SeeWebsiteForEmail at erdani.org>>
> wrote:
>
>     This analogy is tenuous for D because functions are defined to
>     return one type, e.g. typeof(fun(args)) is defined. Once we get into
>     disallowing that for certain functions, we're looking at major
>     language changes for little benefit.
>
>
> I do appreciate this point though...

It is not a valid concern. typeof(fun(args)) would just be a tuple of types.

> Is it currently possible to enumerate a functions argument list?

Yes it is.

> How do you express that? The problems seem very similar to me.

Language built-in tuples, of course.
See std.traits.ParameterTypeTuple.

It is extremely obvious how multiple return values should work.



More information about the Digitalmars-d mailing list