struct Dispatcher
{
        @property
        void opDispatch(string name)(string val)
        {
                writeln(val);
        }
        
        @property
        string opDispatch(string name)()
        {
                return "getter";
        }
        
        void opDispatch(string name)()
        {
                writeln(name);
        }
}


I can't seem to make a "dispatcher" that supports both the normal method syntax and the property syntax simultaneously. Is this going to change in the future?

And if so, how will this be done?

Like this?

struct Dispatcher
{
        @property
        void opPropDispatch(string name)(string val)
        {
                writeln(val);
        }
        
        @property
        string opPropDispatch(string name)()
        {
                return "getter";
        }
        
        void opDispatch(string name)()
        {
                writeln(name);
        }
}

I've got absolutely no clue.

Reply via email to