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

2013-06-18 Thread Darin Adler
Lets bike shed! For some time, functions with names like fooIfExists and ensureFoo have been bothering me. I find both names kind of opaque and unpleasant. Here’s an example: StyleResolver* styleResolverIfExists(); StyleResolver* ensureStyleResolver() What do you think of these names i

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

2013-06-18 Thread Emil A Eklund
On Tue, Jun 18, 2013 at 6:38 PM, Darin Adler wrote: > What do you think of these names instead? > > StyleResolver* optionalStyleResolver(); > StyleResolver& requiredStyleResolver(); +1, much clearer and the pointer vs reference makes it even more so. Perhaps enough so that the required pr

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

2013-06-18 Thread Ryosuke Niwa
On Tue, Jun 18, 2013 at 6:38 PM, Darin Adler wrote: > Lets bike shed! > > For some time, functions with names like fooIfExists and ensureFoo have > been bothering me. I find both names kind of opaque and unpleasant. Here’s > an example: > > StyleResolver* styleResolverIfExists(); > StyleR

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

2013-06-18 Thread Darin Adler
On Jun 18, 2013, at 7:05 PM, Ryosuke Niwa wrote: > requiredStyleResolver sounds as if it's a special (required) type of a style > resolver as opposed to the caller requiring it. That is true. > Why don't we call it requireStyleResolver() instead? Functions with return values don’t read well w

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

2013-06-18 Thread Darin Adler
On Jun 18, 2013, at 7:05 PM, Ryosuke Niwa 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 ___

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

2013-06-18 Thread Simon Fraser
On Jun 18, 2013, at 7:11 PM, Darin Adler wrote: > On Jun 18, 2013, at 7:05 PM, Ryosuke Niwa 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 no

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

2013-06-18 Thread Maciej Stachowiak
If the semantic is essentially that of a getter that just happens to lazily create what it gets on demand, then I don't think "require" or "required" is needed. It can just be named as a getter. If the side effect is very important and especially if clients ever call the function only for its si

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

2013-06-18 Thread Ryosuke Niwa
On Tue, Jun 18, 2013 at 7:20 PM, Simon Fraser wrote: > On Jun 18, 2013, at 7:11 PM, Darin Adler wrote: > > On Jun 18, 2013, at 7:05 PM, Ryosuke Niwa 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, > anal

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

2013-06-19 Thread Gavin Barraclough
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

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

2013-06-19 Thread Maciej Stachowiak
On Jun 18, 2013, at 10:16 PM, Ryosuke Niwa wrote: > On Tue, Jun 18, 2013 at 7:20 PM, Simon Fraser wrote: >> On Jun 18, 2013, at 7:11 PM, Darin Adler wrote: >> >>> On Jun 18, 2013, at 7:05 PM, Ryosuke Niwa wrote: >>> Why don't we call it requireStyleResolver() instead? >>> >>> I’m warm

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

2013-06-19 Thread Balazs Kelemen
For me optional seems very misleading and generally different prefixes suggests that those objects are not the same. Maybe IfExists does not sound nicely but at least it's clear. I would choose to have a pointer version with IfExists and a reference version which is a noun, like: StyleResolver

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

2013-06-19 Thread Timothy Hatcher
What about? StyleResolver* existingStyleResolver() StyleResolver& styleResolver() — Timothy Hatcher On Jun 19, 2013, at 11:49 AM, Balazs Kelemen wrote: > For me optional seems very misleading and generally different prefixes > suggests that those objects are not the same. > Maybe IfExists do

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

2013-06-19 Thread Andreas Kling
On Jun 19, 2013, at 6:37 PM, Timothy Hatcher wrote: > What about? > > StyleResolver* existingStyleResolver() > StyleResolver& styleResolver() +1 to these two. -Kling AKA the guy who named the methods we’re bike shedding about. :|___ webkit-dev mailin

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

2013-06-19 Thread Geoffrey Garen
On Jun 18, 2013, at 7:03 PM, Emil A Eklund wrote: > +1, much clearer and the pointer vs reference makes it even more so. > Perhaps enough so that the required prefix could be dropped: > > StyleResolver* optionalStyleResolver(); > StyleResolver& styleResolver(); I love this! On Jun 18, 2013, at

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

2013-06-19 Thread Elliott Sprehn
On Wed, Jun 19, 2013 at 9:46 AM, Andreas Kling wrote: > On Jun 19, 2013, at 6:37 PM, Timothy Hatcher wrote: > > What about? > > StyleResolver* existingStyleResolver() > StyleResolver& styleResolver() > > > This doesn't make sense since calling styleResolver() again won't create a new one so it's

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

2013-06-21 Thread Maciej Stachowiak
On Jun 19, 2013, at 4:22 PM, Elliott Sprehn wrote: > > On Wed, Jun 19, 2013 at 9:46 AM, Andreas Kling wrote: > On Jun 19, 2013, at 6:37 PM, Timothy Hatcher wrote: > >> What about? >> >> StyleResolver* existingStyleResolver() >> StyleResolver& styleResolver() > > > This doesn't make sense

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

2013-06-30 Thread Dan Bernstein
On Jun 19, 2013, at 7:37 PM, Timothy Hatcher wrote: > What about? > > StyleResolver* existingStyleResolver() > StyleResolver& styleResolver() I like it. > > — Timothy Hatcher > > > On Jun 19, 2013, at 11:49 AM, Balazs Kelemen wrote: > >> For me optional seems very misleading and general

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

2013-06-30 Thread Filip Pizlo
Sent from my PDP-11 On Jun 19, 2013, at 9:41 AM, Dan Bernstein wrote: > > > On Jun 19, 2013, at 7:37 PM, Timothy Hatcher wrote: > >> What about? >> >> StyleResolver* existingStyleResolver() >> StyleResolver& styleResolver() > > I like it. > >> >> — Timothy Hatcher >> >> >> On Jun 19,

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

2013-07-01 Thread Ryosuke Niwa
On Sun, Jun 30, 2013 at 9:39 PM, Filip Pizlo wrote: > On Jun 19, 2013, at 9:41 AM, Dan Bernstein wrote: > > > > > > > On Jun 19, 2013, at 7:37 PM, Timothy Hatcher wrote: > > > >> What about? > >> > >> StyleResolver* existingStyleResolver() > >> StyleResolver& styleResolver() > > > > I like it.

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

2013-07-01 Thread Brady Eidson
On Jul 1, 2013, at 5:27 PM, Ryosuke Niwa wrote: > On Sun, Jun 30, 2013 at 9:39 PM, Filip Pizlo wrote: > On Jun 19, 2013, at 9:41 AM, Dan Bernstein wrote: > > > > > > > On Jun 19, 2013, at 7:37 PM, Timothy Hatcher wrote: > > > >> What about? > >> > >> StyleResolver* existingStyleResolver() >

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

2013-07-01 Thread Dan Bernstein
On Jul 1, 2013, at 7:31 PM, Brady Eidson wrote: > > On Jul 1, 2013, at 5:27 PM, Ryosuke Niwa wrote: > >> On Sun, Jun 30, 2013 at 9:39 PM, Filip Pizlo wrote: >> On Jun 19, 2013, at 9:41 AM, Dan Bernstein wrote: >> >> > >> > >> > On Jun 19, 2013, at 7:37 PM, Timothy Hatcher wrote: >> > >> >

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

2013-07-02 Thread Maciej Stachowiak
On Jul 1, 2013, at 7:31 PM, Brady Eidson wrote: > > On Jul 1, 2013, at 5:27 PM, Ryosuke Niwa wrote: > >> I concur. Maybe >> StyleResolver* styleResolverIfExists() >> StyleResolver& styleResolver() >> ? > > I concur with this. > > For this entire discussion, this is where I was hoping it wa

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

2013-07-03 Thread Bem Jones-Bey
On Jul 2, 2013, at 17:06, "Maciej Stachowiak" mailto:m...@apple.com>> wrote: On Jul 1, 2013, at 7:31 PM, Brady Eidson mailto:beid...@apple.com>> wrote: On Jul 1, 2013, at 5:27 PM, Ryosuke Niwa mailto:rn...@webkit.org>> wrote: I concur. Maybe StyleResolver* styleResolverIfExists() StyleReso

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

2019-02-21 Thread Ryosuke Niwa
I guess we never remembered to update our style guideline back in 2013. I've uploaded a patch to do this: https://bugs.webkit.org/show_bug.cgi?id=194930 - R. Niwa ___ webkit-dev mailing list webkit-dev@lists.webkit.org https://lists.webkit.org/mailman/l

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

2019-02-21 Thread Ryosuke Niwa
For those who joined webkit-dev after June 2013, see https://lists.webkit.org/pipermail/webkit-dev/2013-June/thread.html#25056 On Thu, Feb 21, 2019 at 7:54 PM Ryosuke Niwa wrote: > I guess we never remembered to update our style guideline back in 2013. > > I've uploaded a patch to do this: > htt