RFC: singletons and memory management
Ian Monroe
ian at monroe.nu
Thu Sep 11 05:50:56 CEST 2008
On Wed, Sep 10, 2008 at 5:00 PM, Soren Harward <stharward at gmail.com> wrote:
> On Wednesday 10 September 2008 17:38:06 Ian Monroe wrote:
>> if (The::playlistModel() )
>> The::playlistModel()->something()
>
> But if The::playlistModel() is just an alias for PlaylistModel::instance()
> (which it is in every single case that I've looked at so far),
I don't think it is, The::playlistModel is just the name of the
instance function. There is no Playlist::Model::instance. The "The"
namespace is just a more pretty way to do it.
Sometimes they are aliases, but thats from people (myself included)
not knowing how to get the friending right.
> then you don't
> have to check if The::playlistModel() exists, because as soon as you call it,
> it does. That's the whole point of a singleton.
>
Suppose I hadn't thought of that all the way through. :D
In my defense, sometimes singletons are only created explicitly,
though I don't know if we do that in our current code.
Anyways everyone knows the bike shed is supposed to be green.
Ian
More information about the Amarok-devel
mailing list