[webkit-dev] Naming scheme for fooIfExists/ensureFoo - Round 2

Chris Dumez cdumez at apple.com
Thu Oct 3 14:24:50 PDT 2024


Hi,

> On Oct 3, 2024, at 1:47 PM, Ryosuke Niwa via webkit-dev <webkit-dev at lists.webkit.org <mailto:webkit-dev at lists.webkit.org>> wrote:
> 
> 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();

I have been using this style consistently so this is my personal preference. That said, I agree with you we should just agree on one and use it consistently (and add to coding style).
Do we have stats about which pattern is more common in our codebase?

Chris.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20241003/32a7c59d/attachment.htm>


More information about the webkit-dev mailing list