[webkit-dev] Pattern for singleton classes instance getters

Chris Dumez cdumez at apple.com
Fri Jan 30 13:56:22 PST 2015


Hi,

I made the changes in:
<http://trac.webkit.org/changeset/179401>
<http://trac.webkit.org/changeset/179409>

Kr,
--
Chris Dumez - Apple Inc.
Cupertino, CA




> On Jan 29, 2015, at 10:23 AM, Chris Dumez <cdumez at apple.com> wrote:
> 
> Hi all,
> 
> Thanks for the feedback.
> 
> I submitted a coding style update proposal at Bug 141040 <https://bugs.webkit.org/show_bug.cgi?id=141040>.
> Based on the mailing list feedback, the proposal is to use a static member function named "singleton()”.
> 
> I will also upload a patch to align our existing code unless there is any objection.
> 
> Kr,
> --
> Chris Dumez - Apple Inc.
> Cupertino, CA
> 
> 
> 
> 
>> On Jan 28, 2015, at 9:26 PM, Ryosuke Niwa <rniwa at webkit.org <mailto:rniwa at webkit.org>> wrote:
>> 
>> On Wed, Jan 28, 2015 at 9:19 PM, Maciej Stachowiak <mjs at apple.com <mailto: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
>> _______________________________________________
>> webkit-dev mailing list
>> webkit-dev at lists.webkit.org <mailto:webkit-dev at lists.webkit.org>
>> https://lists.webkit.org/mailman/listinfo/webkit-dev
> 
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.webkit.org/pipermail/webkit-dev/attachments/20150130/1d6754a8/attachment.html>


More information about the webkit-dev mailing list