Doesn't D have the ability to do stuff on class initialization? Or does it not initialize classes lazily?<p>In Java, this is how a threadsafe Singleton looks like:<p><pre><code> private static MySingleton instance = new MySingleton();
</code></pre>
It will be initialized when the class is first used.<p>The whole double-checked locking and TLS thing is IMO a huge pointless smartassery contest in VM lawyering hinging on the eminently false premise that having singletons in a heavily multithreaded environment initialized sooner than they're used is a problem that anyone needs solved.<p>Whereas in reality, 90% of all applications don't need lazy loading, and for 90% of those that do, the above is lazy enough.