When a user defined type is used as an attribute like this:
// the attribute
struct MyAttrib
{
    immutable string name;
    imuttable int sz;
    immutable string defaultvalue;
}

// using the attribute
class Data
{
// field 'id' has attribute MyAttrib with name and sz set to 'fancy name'
    // and 10 resp.
    @MyAttrib( "fancy name", 10 )
    long id;
    ...
}


But how do I only set the MyAttrib.defaultvalue?

class OtherData
{
    //@MyAttrib( ??defaultvalue = "null" ?? )
    //@MyAttrib( string.init, int.init, "null" ) //seems to work?
    long id;
    ...
}

MyAttrib instances may be initialized like this:

auto myattrib = { defaultvalue:"null" };

But this seems not possible when using MyAttrib as attribute.

Reply via email to