Is it possible to handle 'magic' property assignments a'la PHP?
Gary Willoughby
dev at nomad.so
Sat Jan 4 11:26:49 PST 2014
On Saturday, 4 January 2014 at 19:19:43 UTC, Gary Willoughby
wrote:
> On Saturday, 4 January 2014 at 19:17:31 UTC, Gary Willoughby
> wrote:
>> OMG i've just found opDispatch!
>>
>> http://dlang.org/operatoroverloading.html#Dispatch
>>
>> Fantastic!
>
> How to handle returning a value from a non-existent property?
Got it!
public void opDispatch(string s)(string value)
{
// handle.
}
public string opDispatch(string s)()
{
return "value";
}
More information about the Digitalmars-d-learn
mailing list