https://issues.dlang.org/show_bug.cgi?id=23264

--- Comment #2 from Bolpat <[email protected]> ---
(In reply to wolframw from comment #1)
> There would be an ambiguity for nested functions:
> 
> void foo(T1...)(T1 args1)
> {
>     typeof(__traits(parameters))[0] bar(T2...)(T2 args2)
>     {
>         // ...
>     }
> }
> 
> Would the return value of bar depend on foo's or bar's parameters?
> Currently, it would refer to foo's parameters.

Good catch! I don’t think it’s a big problem. Return types are ambiguous in the
same fashion:

void f(T)()
{
    T g(T)() { return T.init; }
}

The `T` value that function `g` returns could – for the uninformed reader –
mean f’s type parameter or g’s type parameter (of course, it’s g’s). I see no
reason why __traits(parameters) would work any differently. Also, if you wanted
the outer function’s parameters, one can alias them.

void foo(T1...)(T1 args1)
{
    alias fooParams = typeof(__traits(parameters));
    fooParams[0] bar(T2...)(T2 args2)
    {
        // ...
    }
}

--

Reply via email to