Boost logo

Boost :

From: Anthony Williams (anthony_w.geo_at_[hidden])
Date: 2008-01-15 06:21:16

John Torjo <john.groups <at>> writes:

> Today starts the formal Fast-Track review of the Boost.Utility/Singleton
> library. This is a very useful utility, so I'm expecting lots of reviews ;)

> * What is your evaluation of the potential usefulness of the library?

I don't think this is at all useful. People should not be encouraged to use
singletons, as there is already a tendency towards overuse. In most
circumstances, singletons are a poor design choice, so there is little
requirement for their use.

> * What is your evaluation of the design?
> * What is your evaluation of the implementation?

The design mixes several independent issues --- ensuring there is only one
instance of a class and avoiding initialization order problems with on-demand
initialization for starters.

A simple wrapper class that allows for on-demand initialization, would be
useful. Conflating that with "there shall be at most one instance" is not.

Again, allowing for a preferred destruction sequence of objects with such
on-demand initialization might also be useful, but does not belong with the
one-instance constraint.

thread_specific_singleton is overly complex for what should just amount to a
simple use of thread_specific_ptr.

> * Did you try to use the library? With what compiler?
> Did you have any problems?

No, I haven't tried to use it.

> * How much effort did you put into your evaluation?

I've read through the code and documentation carefully.

> * Are you knowledgeable about the problem domain?

Yes. I've written code that used singletons (and regretted it later), and used
code that other people have written containing singletons.

> * Do you think the library should be accepted as a Boost library?



Boost list run by bdawes at, gregod at, cpdaniel at, john at