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@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@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-dev