This bug report: http://d.puremagic.com/issues/show_bug.cgi?id=7979
... made me think about the following scenario:

struct MyStruct
{
    int    _intValue;
    string _strValue;

    alias _intValue this;
    alias _strValue this;
}

void main()
{
    auto ms = MyStruct(1, "two");

    switch (ms)
    {
    case MyStruct(1, "one"):
        // To be here...
        break;

    case MyStruct(2, "two"):
        // ... or here?
        break;

    default:
        // Not here though
    }
}

Should that switch statement:
a) Give an error saying "ms is neither integral nor string"
b) Cast its conditional- and case-expressions to int
c) Cast its conditional- and case-expressions to string

I understand multiple alias this statements will be possible at some point?

Reply via email to