Dynamic loading, D all the way (dmd 64bit 2.060/Ubuntu 64bit 12.04/x86_64)

Paulo Pinto pjmlp at progtools.org
Wed Aug 22 09:57:22 PDT 2012


On Wednesday, 22 August 2012 at 15:51:05 UTC, Philip Daniels 
wrote:
>>snip<
>
> If we had dynamic loading, would we be able to do dependency
> injection in D?

Dependency injection does not require dynamic loading per se.

It is all about using interfaces instead of classes, and 
initializing the corresponding instance members.

You just need some piece of code that takes the responsibility of 
locating such interfaces, by registering the classes somehow, or 
by compile time reflection, which gets called on program 
initialization.

You can do this in D today.

--
Paulo


More information about the Digitalmars-d mailing list