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

Chris Dumez cdumez at apple.com
Thu Oct 3 14:46:39 PDT 2024



> On Oct 3, 2024, at 2:37 PM, Said Abou-Hallawa <sabouhallawa at apple.com> wrote:
> 
> Object* objectIfExists() { return m_object.get(); }
> Object* object(); // It try to create m_object but it still may return nullptr;


Well, this is super confusing to me and I think we should find a better pattern for this particular edge case. Maybe something with “try” in the name like we do for “tryCreate()” factory functions.
`Object* object()` & `Object* tryEnsureObject()` ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20241003/6d4971f8/attachment.htm>


More information about the webkit-dev mailing list