What is the meaning of this?

Lawrence Kesteloot lk at teamten.com
Sun Jan 31 14:17:07 PST 2010


On Sun, Jan 31, 2010 at 1:39 AM, Peter Levart <peter.levart at gmail.com> wrote:
> #int(int) factorial =  #fact(int i)(i == 0 ? 1 : i * (int) (fact.(i - 1)));

That's where you'd want the optional return type to go. Better to just
allow a reference to the "factorial" variable.

For example, if the compiler can't deduce the return type above, then
you'd write:

    #int(int) factorial =  #int(int i)(i == 0 ? 1 : i * factorial.(i - 1));

Does the optional return type require parentheses around the
expression? E.g. this might not work:

    #int(int) identity = #int(int i) i;

Parentheses might be required:

    #int(int) identity = #int(int i)(i);

Lawrence


More information about the lambda-dev mailing list