[webkit-dev] Naming scheme for fooIfExists/ensureFoo - Round 2
youenn fablet
youennf at gmail.com
Thu Oct 3 14:25:15 PDT 2024
I tend to prefer ensureXXX(). It also maps nicely with HashMap::ensure.
Le jeu. 3 oct. 2024 à 13:48, Ryosuke Niwa via webkit-dev <
webkit-dev at lists.webkit.org> a écrit :
> Hi all,
>
> We discussed this topic 11 years ago in
> https://lists.webkit.org/pipermail/webkit-dev/2013-June/025056.html but
> we seem to have never codified it in our coding style guideline. It really
> bothers me that we have a mixture of two styles so I’d like to propose that
> we pick one style and put that into style guideline & style checker.
>
> The question is as follows. A pair of functions which lazily construct an
> object and one which returns nullptr if the object had not already been
> constructed can be named:
>
> StyleResolver* styleResolver();
> StyleResolver& ensureStyleResolver();
>
> or:
>
> StyleResolver* styleResolverIfExists();
> StyleResolver& styleResolver();
>
> Which one should we use?
>
> - R. Niwa
>
> _______________________________________________
> 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: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20241003/07ac727c/attachment.htm>
More information about the webkit-dev
mailing list