The future of UDAs.

Max Samukha maxsamukha at gmail.com
Wed Nov 28 08:23:21 PST 2012


On Wednesday, 28 November 2012 at 15:54:52 UTC, Manu wrote:
>>
>> 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 ;)

That is a problem for anyone who builds a library for general 
use. Static constructors in mixins are inapt unless you want to 
impose a certain project structure (no circular imports) on your 
users.




More information about the Digitalmars-d mailing list