opPropDispatch
David
d at dav1d.de
Sun Apr 22 13:30:01 PDT 2012
Am 22.04.2012 22:11, schrieb sclytrack:
>
>
> 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.
>
For now you can do it *without* @property and compile *without* -property
More information about the Digitalmars-d-learn
mailing list