Low-Lock Singletons In D

Diggory diggsey at googlemail.com
Mon May 6 14:11:44 PDT 2013


On Monday, 6 May 2013 at 21:13:24 UTC, Andrej Mitrovic wrote:
> On 5/6/13, dsimcha <dsimcha at yahoo.com> wrote:
>> On the advice of Walter and Andrei, I've written a blog article
>> about the low-lock Singleton pattern in D.
>
> Personally this covers it for me:
>
> final abstract class singleton
> {
> static:
>     void foo() { }
>     int f;
> }
>
> void main()
> {
>     singleton.foo();
>     singleton.f = 1;
> }
>
> Never needed anything more complex than that. :p

Although that's only a single-per-thread-ton :P


More information about the Digitalmars-d mailing list