On Monday, 30 May 2016 at 10:09:19 UTC, chmike wrote:
This code compile, but array appending doesn't work

----
alias Rebindable!(immutable(InfoImpl)) Info;

class InfoImpl
{
    void foo() {}
    static immutable(InfoImpl) info()
    {
        __gshared immutable InfoImpl x = new immutable InfoImpl;
        return x;
    }
}


void main()
{
    Info t = Info.info;
    Info[] a;
    //a ~= Info.info; <--  KO Compiler Error
    a ~= rebindable(Info.info); // Ok
}
-----

Why can't info() return a Rebindable!(immutable(InfoImpl)) ?

What do you mean? `info` returns an `immutable(InfoImpl)`, not a `Rebindable!(immutable(InfoImpl))`. Rebindable doesn't apply itself to the return types of the methods of the return types (there's no reason to).

Reply via email to