Thread overview
February 25, 2021
Say, please,
how to convert string to type ?

Is:
    interface IX
    {
        //
    }

    mixin template X()
    {
        //
    }

    // Mixin templates to class.
    //   Scan class interfaces, then mix
    mixin template Members()
    {
        alias T = typeof( this );

        static
        foreach ( IFACE; InterfacesTuple! T )
        {
            pragma( msg, IFACE );
            pragma( msg, IFACE.stringof[ 1 .. $ ] );

            static
            if ( IFACE.stringof.length > 1 && IFACE.stringof[ 1 .. $ ] )
            {
                mixin ( IFACE.stringof[ 1 .. $ ] )!(); // <-- HERE TROUBLE
            }
        }
    }

    class A : IX
    {
        mixin Members!();
    }

Want:
    // Mixin template
    mixin IFACE.stringof[ 1 .. $ ] !();

Got:
    Compilation error: "declaration expected"

source: https://run.dlang.io/is/smFaWc

Help wanted.

February 25, 2021
On Thursday, 25 February 2021 at 06:51:11 UTC, Виталий Фадеев wrote:
> Say, please,
> how to convert string to type ?
>
> [...]

Simple version of this question is:
   string t = "X";
   mixin t!();   // <-- HERE TROUBLE
February 25, 2021
On Thursday, 25 February 2021 at 06:53:28 UTC, Виталий Фадеев wrote:
> On Thursday, 25 February 2021 at 06:51:11 UTC, Виталий Фадеев wrote:
>> Say, please,
>> how to convert string to type ?
>>
>> [...]
>
> Simple version of this question is:
>    string t = "X";
>    mixin t!();   // <-- HERE TROUBLE

I was stupid.
Solution is:
    mixin ( "mixin " ~ IFACE.stringof[ 1 .. $ ] ~ "!();" );

Thanks!