Put Tuple in templates in a class fails

Philippe Sigaud philippe.sigaud at gmail.com
Sun May 13 05:54:54 PDT 2012


On Sun, May 13, 2012 at 11:58 AM, Xan <xancorreu at gmail.com> wrote:
> Thank you very much, Philippe.
>
> I have several questions:
>
> * Why do you think I can't compose functions with tuples? Your implentation
> does exactly this, isn't?

Well, in D functions can only return one value. So you cannot compose
them with functions asking for more than one argument.

For example, your code allows Algorisme!(int, double, string,
float[]), which needs a 3-tuple as input (namely,
(double,string,float[]) ) and returns an int.
What kind of other Algorisme could be used as input for the one before?
In general, you'll compose only functions taking one type and
returning one type.

Except if you auto-detect a std.typecons.Tuple and crack it open, I guess.

>
> * What is RHS?

Right Hand Side (as opposed to lhs, Left Hand Side), the thing on the
right-hand side of the operator. Sorry for the acronym.


Philippe


More information about the Digitalmars-d-learn mailing list