Tony <[email protected]> wrote:

Hi, thanks for your reply but what you suggest is not enough.

With your solution you cannot add new advice without breaking stuff elsewhere. You don't want to clutter the namespace with lots of new function names. What you would want is to actually inject the code into the present functions.

What would make this even more modular is if you could use the mixin statement outside of the scope that you want to inject into by specifying the location:
    mixin acme.nuclear.Lollipop SomeAdvice;

That way you could extend code without touching its source.

D, by its static and compiled nature, does not support what you
ask of it. :(

There are however ways to do it. First thing that comes to my mind
is a template that creates a subclass wherein member functions are
wrapped in functions that mixin the wanted functionality. This
functionality could then include function pointers or delegates that
may be changed at runtime.

--
Simen

Reply via email to