On 28 November 2012 17:47, Max Samukha <[email protected]> wrote: > On Tuesday, 27 November 2012 at 16:19:59 UTC, Manu wrote: > >> On 27 November 2012 17:49, Gor Gyolchanyan <[email protected]>* >> *wrote: >> >> Can you implement this use case? >>> Have classes mix in something,, which will register them in a single >>> place, which can later suppl the registered classes as a type tuple. >>> >>> >> I don't do it as a type tuple, why do you need that? >> I do it as a runtime registry. >> >> I have 'mixin RegisterModule;' at the top of every module. >> > > And at this point we are back to the famous problem with static > constructors in circularly imported modules: > > module a; > import b; > mixin RegisterModule; > > > module b; > import a; > mixin RegisterModule; >
Certainly a potential problem, but I've set up my code such that these static constructors themselves have no external dependencies, and initialisation order is unimportant, since registered stuff just ends up in a globally accessible hash table anyway. Not a problem for me, but I have encountered this problem in other situations, and also prototype configurations ;)
