[webkit-dev] Pattern for singleton classes instance getters

Ryosuke Niwa rniwa at webkit.org
Wed Jan 28 21:26:37 PST 2015

On Wed, Jan 28, 2015 at 9:19 PM, Maciej Stachowiak <mjs at apple.com> wrote:

> This may be a question of what jargon we've encountered, but to me,
> "singleton" clearly means "the one unique instance of this class" while
> "instance" means "any instance of this class". If I hadn't seen this
> thread, I would interpret Class::instance() to mean "create a brand new
> instance of this class" rather than "return the unique singleton instance
> of this class, creating if necessary".

Agreed.  I also prefer Class::singleton() over Class::instance().

- R. Niwa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-dev/attachments/20150128/a238883e/attachment.html>

More information about the webkit-dev mailing list