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.

  • string to type Виталий Фадеев via Digitalmars-d-learn

Reply via email to