On Mon, 06 May 2013 17:36:00 -0400, Andrej Mitrovic <andrej.mitrov...@gmail.com> wrote:

On 5/6/13, Diggory <digg...@googlemail.com> wrote:
Although that's only a single-per-thread-ton :P

My bad.

final abstract class singleton
{
__gshared:
    void foo() { }
    int f;
}

The point that is missed is the lazy creation. Imagine if it's not just an int but a whole large resource, which takes a long time to create/open.

If all we cared about is access, and you *know* you are going to need it, you can just create it eagerly via shared static this(). That is not what the singleton pattern is for.

-Steve

Reply via email to