Centralizable configured compile-time class instantiation

shd alienballance at gmail.com
Tue Jul 12 10:47:25 PDT 2011


2011/7/12 Kagamin <spam at 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 :)


More information about the Digitalmars-d-learn mailing list