Program size, linking matter, and static this()

so so at
Sat Dec 17 04:34:44 PST 2011

On Sat, 17 Dec 2011 01:50:51 +0200, Jonathan M Davis <jmdavisProg at>  

> On Friday, December 16, 2011 17:13:49 Andrei Alexandrescu wrote:
>> Maybe there's an issue with the design. Maybe Singleton (the most damned
>> of all patterns) is not the best choice here. Or maybe the use of an
>> inheritance hierarchy with a grand total of 4 classes. Or maybe the
>> encapsulation could be rethought.
>> The general point is, a design lives within a language. Any language is
>> going to disallow a few designs or make them unsuitable for particular
>> situation. This is, again, multiplied by the context: it's the standard
>> library.
> I don't know what's wrong with singletons. It's a great pattern in  
> certain
> circumstances.

I don't like patterns much but when it comes to singleton i absolutely  
hate it.
Just ask yourself what does it do to earn that fancy name. NOTHING. It is  
nothing but a
hype of those who want to rule everything with one paradigm. Generic  
are our final target WHEN they are elegant.

If you are using singleton in your C++/D (or any other M-P language) code,  
do yourself a favor and trash that book you learned it from.

class A {
   static A make();

class B;
B makeB();

What A.make can do makeB can not? (Other than creating objects of two  
different types :P )

More information about the Digitalmars-d mailing list