Singleton Pattern
Ali Çehreli via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Jul 9 13:47:32 PDT 2016
On 07/09/2016 01:35 PM, Suliman wrote:
> On Thursday, 5 January 2012 at 22:53:12 UTC, Ali Çehreli wrote:
>> On 01/05/2012 02:15 PM, asm wrote:
>>> how can i implementing the singleton pattern in D?
>>
>> Is singleton still alive? ;)
I'm glad I was alive in 2012. :o)
>> An idea is to instantiate the object in the module's static this().
>>
>> Ali
>
> Yeah, same question, what difference between singleton and `static
this()`?
I'm now aware of the difference between 'static this()' and 'shared
static this()'.:
shared static this(): Executed once for the whole program
static this(): Executed per thread
Ali
More information about the Digitalmars-d-learn
mailing list