The future of UDAs.

Manu turkeyman at gmail.com
Wed Nov 28 07:54:43 PST 2012


On 28 November 2012 17:47, Max Samukha <maxsamukha at gmail.com> wrote:

> On Tuesday, 27 November 2012 at 16:19:59 UTC, Manu wrote:
>
>> On 27 November 2012 17:49, Gor Gyolchanyan <gor.f.gyolchanyan at gmail.com>*
>> *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 ;)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20121128/e32846e0/attachment.html>


More information about the Digitalmars-d mailing list