[webkit-dev] For your consideration: Naming scheme for fooIfExists/ensureFoo
rniwa at webkit.org
Mon Jul 1 17:27:39 PDT 2013
On Sun, Jun 30, 2013 at 9:39 PM, Filip Pizlo <fpizlo at apple.com> wrote:
> On Jun 19, 2013, at 9:41 AM, Dan Bernstein <mitz at apple.com> wrote:
> > On Jun 19, 2013, at 7:37 PM, Timothy Hatcher <timothy at apple.com> wrote:
> >> What about?
> >> StyleResolver* existingStyleResolver()
> >> StyleResolver& styleResolver()
> > I like it.
> >> — Timothy Hatcher
> >> On Jun 19, 2013, at 11:49 AM, Balazs Kelemen <kbalazs at webkit.org>
> >>> For me optional seems very misleading and generally different prefixes
> suggests that those objects are not the same.
> >>> Maybe IfExists does not sound nicely but at least it's clear. I would
> choose to have a pointer version with IfExists and a reference version
> which is a noun, like:
> >>> StyleResolver* styleResolverIfExists()
> I like this more. I like that the use of 'if' in the name alerts me to the
> fact that the function will return something conditionally.
> By contrast, "existingFoo" only makes sense to me if I'm already aware of
> the idiom. And although I probably will *become* aware of the idiom it will
> still nonetheless be one of many idioms that I have to be aware of, so I
> fear that I'll forget why "Foo" is qualified with "existing". That's why I
> like "fooIfExists" - its super explicit about what is going on.
I concur. Maybe
- R. Niwa
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the webkit-dev