On Sun, Jun 30, 2013 at 9:39 PM, Filip Pizlo <fpi...@apple.com> wrote:

> On Jun 19, 2013, at 9:41 AM, Dan Bernstein <m...@apple.com> wrote:
>
> >
> >
> > On Jun 19, 2013, at 7:37 PM, Timothy Hatcher <timo...@apple.com> wrote:
> >
> >> What about?
> >>
> >> StyleResolver* existingStyleResolver()
> >> StyleResolver& styleResolver()
> >
> > I like it.
> >
> >>
> >> — Timothy Hatcher
> >>
> >>
> >> On Jun 19, 2013, at 11:49 AM, Balazs Kelemen <kbal...@webkit.org>
> wrote:
> >>
> >>> 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
StyleResolver* styleResolverIfExists()
StyleResolver& styleResolver()
?

- R. Niwa
_______________________________________________
webkit-dev mailing list
webkit-dev@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-dev

Reply via email to