[webkit-dev] Pattern for singleton classes instance getters
Darin Adler
darin at apple.com
Wed Jan 28 16:28:54 PST 2015
I like the economy of the smaller non-member function name; it seems overly wordy to be constantly stating the class name as well as the nearly meaningless word “shared”. I think the word “shared” is what I like least about the member function approach.
It had always thought that we used static member functions for this to replicate the pattern from Objective-C, and it seems more idiomatic modern C++ to use a free function for this kind of thing.
Maciej’s point about Class::create() might be enough to convince me to change my view, though; it’s hard to see any reason the same logic wouldn’t apply in that case.
— Darin
More information about the webkit-dev
mailing list