www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Adaptation

Hi all,

I think this is not possible, but I'm using two different 
templated libraries, and I'm wondering if there's a way of 
adapting that:

     module external.foo;
     struct Foo { Foo[] foos }

     module external.spam;
     void spammer(T foolike){ foreach(s; foolike.spams){ ... } }

     module mymain;
     import external.foo, external.spam;

     auto spams(ref Foo foo){ return foo.foos; }

     void main(){
         spammer(Foo()); // nope, the function is not visible in 
module external.spam
     }

What I'm searching is something like:

     alias Foo.spams = Foo.foos;

But I guess that this is against every golden rule of good 
programming...

Thanks,
---
Paolo
Oct 09 2013