Using opDispatch as *magic* getter/setter. Possible or not?

spir denis.spir at gmail.com
Wed Mar 30 18:50:43 PDT 2011


On 03/31/2011 02:40 AM, Aleksandar Ružičić wrote:
> 2011/3/31 Aleksandar Ružičić<ruzicic.aleksandar at gmail.com>:
>>
>> Or maybe there is some other way to achive what I want and I'm not
>> aware of it? :-)
>>
>
> I know I could have used opIndex and opIndexAssign but I really want
> config.section.entry syntax instead of config["section"]["entry"]...

Agreed. And I would really have an answer to your question, since I tried to do 
the same thing. Don't understand why D does not have an 'opMember' or 'opDot'. 
Someone knows?
This would be one of the first metamethods I would introduce in a language 
(definitely before operator overloading).

denis
-- 
_________________
vita es estrany
spir.wikidot.com



More information about the Digitalmars-d-learn mailing list