shd Wrote: > 2011/7/12 Kagamin <s...@here.lot>: > > You want an IOC container like Unity? > exactly > > And you want the interface-to-class mapping to be configurable externally > > rather than version out these classes directly in source? > > like > > version(UseGL) > > { > > �static import wrappers.gl; > > �alias wrappers.gl.WindowImpl Window; > > } > > else version(UseWhat) > > { > > �static import wrappers.what; > > �alias wrappers.what.WindowImpl Window; > > } > > container.register!(IWindow,Window)(); > > > > client: > > > > IWindow myWindow=container.resolve!(IWindow)(); > > > that's right :)
Hmm... If you have wrappers/gl/guiImpl/... and wrappers/what/guiImpl/... and conditionally add them to includes for example with -I wrappers/gl you should be able to import guiImpl; and use guiImpl.Window. If it's -I wrappers/what, guiImpl.Window is still guiImpl.Window.