[webkit-dev] For your consideration: Naming scheme for fooIfExists/ensureFoo

Gavin Barraclough barraclough at apple.com
Wed Jun 19 00:13:25 PDT 2013


I find ‘requireStyleResolver()’ a little confusing.  My first expectation is often that a method is an imperative command on the receiver, so I first read 'requireStyleResolver()’ as mandating that the document now requires a StyleResolver, rather than referring to the need of the caller.

In a previous codebase I’ve worked on we used ‘acquire’ as a term of art for lazy creation (as a synonym for get, with an inherent connotation that doing so may nontrivial).

    StyleResolver& acquireStyleResolver();

cheers,
G.

On Jun 18, 2013, at 7:11 PM, Darin Adler <darin at apple.com> wrote:

> On Jun 18, 2013, at 7:05 PM, Ryosuke Niwa <rniwa at webkit.org> wrote:
> 
>> Why don't we call it requireStyleResolver() instead?
> 
> I’m warming to this idea. Maybe we can use “require” as a term of art, analogous to the way we use “create”, to mean “create if not already created”.
> 
> -- Darin
> _______________________________________________
> 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/20130619/29826188/attachment.html>


More information about the webkit-dev mailing list