Static constructors in circularly imported modules - again

Michel Fortin michel.fortin at michelf.com
Thu May 27 08:38:20 PDT 2010


On 2010-05-27 09:57:30 -0400, Max Samukha <spambox at d-coding.com> said:

> We cannot impose on the user of Q_OBJECT the requirement that a and b 
> should not be circularly imported or that he has to manually call an 
> initialization function etc.

Just a small note...

In the D/Objective-C bridge, I've resorted to lazy initialization for 
this kind of thing. This way there is no module constructors and 
circular imports work as expected. But it isn't thread-safe, and I 
expect it would be a pain to make lazy initialization thread-safe, 
although I haven't tried yet.


-- 
Michel Fortin
michel.fortin at michelf.com
http://michelf.com/



More information about the Digitalmars-d mailing list