Program size, linking matter, and static this()

Timon Gehr timon.gehr at gmx.ch
Fri Dec 16 15:31:00 PST 2011


On 12/17/2011 12:18 AM, maarten van damme wrote:
> how did other languages solve this issue? I can't imagine D beeing the
> only language with static constructors, do they have that problem too?

Nobody has solved the issue. The approach in Java and C#, for instance, 
is to call the static constructor lazily upon class load time. That 
means it can be called at an arbitrary point during your program 
execution. And if you accidentally have circular dependencies between 
static constructors, your program may or may not blow up or behave badly.


More information about the Digitalmars-d mailing list