On Saturday, 9 July 2016 at 20:47:32 UTC, Ali Çehreli wrote:
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

Yeah, I understand, I mean that I need way to create instance on Config class, that should not be passed in every instance of class explicitly, because it would need in every class. I know that I can make it's static, but I do not think, that it's good.

Same with singleton, I read that a lot of people blame it.

Reply via email to