Re: [webkit-dev] Naming preference: SetForScope vs. TemporaryChange

2016-12-27 Thread Maciej Stachowiak
> On Dec 26, 2016, at 9:04 AM, Saam Barati wrote: > > Right. I see what you're saying. The name doesn't confuse me with respect to > these semantics but I see that's it's subtly wrong. > > The use case I was thinking of is this: > ` > class Foo { >Foo() :

Re: [webkit-dev] Naming preference: SetForScope vs. TemporaryChange

2016-12-26 Thread Saam Barati
Right. I see what you're saying. The name doesn't confuse me with respect to these semantics but I see that's it's subtly wrong. The use case I was thinking of is this: ` class Foo { Foo() : m_change(someIntVariable, 20) { } ... ... ScopedChange m_change; }; ` Which is

Re: [webkit-dev] Naming preference: SetForScope vs. TemporaryChange

2016-12-26 Thread Antti Koivisto
On Mon, Dec 26, 2016 at 5:29 AM, Maciej Stachowiak wrote: > > ScopedChange(tachyonFlux, 2.0); > I wish there was a compiler warning against this. I have caused at least one bug by doing this exact thing. (a temporary gets deleted at the end of the expression) antti

Re: [webkit-dev] Naming preference: SetForScope vs. TemporaryChange

2016-12-25 Thread Maciej Stachowiak
> On Dec 25, 2016, at 11:35 AM, Saam Barati wrote: > > I like ScopedChange the most out of all the names. It's a bit unfortunate > that such a name doesn't work well in the context of having a ScopedChange as > a member variable. I think TemporaryChange works much better as

Re: [webkit-dev] Naming preference: SetForScope vs. TemporaryChange

2016-12-25 Thread Saam Barati
I like ScopedChange the most out of all the names. It's a bit unfortunate that such a name doesn't work well in the context of having a ScopedChange as a member variable. I think TemporaryChange works much better as a name if the use is as a member variable. My hunch would be the most frequent

Re: [webkit-dev] Naming preference: SetForScope vs. TemporaryChange

2016-12-23 Thread Maciej Stachowiak
A few more coats of paint for the bike shed: It's a little unusual to have a class name that's a verb phrase instead of a noun phrase. And in this case if you interpret "Set" as a noun you'll get entirely the wrong idea. Some alternatives that avoid this, but has the better clarity of "Scope"

Re: [webkit-dev] Naming preference: SetForScope vs. TemporaryChange

2016-12-23 Thread Michael Catanzaro
On Fri, 2016-12-23 at 05:42 +, Yusuke SUZUKI wrote: > Personally I like the name "SetForScope" since the name "scope" > states that this value change is tied to C++ scope. Me too. The name is pretty clear. The first time I saw TemporaryChange I had to look at the implementation to see what it

Re: [webkit-dev] Naming preference: SetForScope vs. TemporaryChange

2016-12-22 Thread Yusuke SUZUKI
Personally I like the name "SetForScope" since the name "scope" states that this value change is tied to C++ scope. On Fri, Dec 23, 2016 at 11:32 JF Bastien wrote: > "Scope" seems to capture the C++ nature better. > > "Temporary" isn't clear on how long it'll last IMO. > > >

Re: [webkit-dev] Naming preference: SetForScope vs. TemporaryChange

2016-12-22 Thread JF Bastien
"Scope" seems to capture the C++ nature better. "Temporary" isn't clear on how long it'll last IMO. On Thu, Dec 22, 2016 at 6:28 PM Saam barati wrote: > Hi all, > > Recently, Yusuke found that JSC and WTF both had the exact same RAII > helper data structure. JSC called it

[webkit-dev] Naming preference: SetForScope vs. TemporaryChange

2016-12-22 Thread Saam barati
Hi all, Recently, Yusuke found that JSC and WTF both had the exact same RAII helper data structure. JSC called it SetForScope, and WTF called it TemporaryChange. (Details here: https://bugs.webkit.org/show_bug.cgi?id=164761 ). Yusuke went to