On Thu, 31 Mar 2011 02:32:35 +0200, Aleksandar Ružičić <ruzicic.aleksan...@gmail.com> wrote:

Is it possible to use opDispatch as generic getter and setter at the
same time? Something like __get() and __set() in PHP..

this is what I've tried: https://gist.github.com/895571

and I get Error: template instance opDispatch!("bar") matches more
than one template declaration, path\to\test.d(57):opDispatch(string
entryName) and path\to\test.d(66):opDispatch(string entryName)

Is mixing @property with opDispatch supposed to work at all or is
opDispatch only ment for method calls?

Or maybe there is some other way to achive what I want and I'm not
aware of it? :-)

Bug 620[1] is related to what you ask. I have written a solution there,
but I do not remember how well it works, and have no way of testing it
currently:

template opDispatch( string name ) {
    auto opDispatch( T... )( T args ) {
        // Do something!
    }
}

[1]: http://d.puremagic.com/issues/show_bug.cgi?id=620

--
Simen

Reply via email to