Boost logo

Boost :

From: Andrey Semashev (andysem_at_[hidden])
Date: 2005-09-23 12:55:49


Rob Stewart wrote:
> From: "Jeff Flinn" <TriumphSprint2000_at_[hidden]>
>>
>> scope_guard g;
>>
>> if (a) at_ease(g);
>> ...
>> if (b) attention(g); // emphasizing the appropriate syllables!
>
> Interesting. "At ease" avoids the notion that "dismiss" raises
> of the guard no longer being around. It suggests that the guard
> isn't paying attention.
>
> Unfortunately, I don't think "at_ease" reads all that well in the
> code. One usually doesn't tell code to "take it easy" or "chill"
> for a while, at least not in so many words. It just sounds
> strange to me.
>
> So, if you choose to keep "dismiss," which really does seem like
> a nice choice, what is a good antonym? An interesting near
> antonym is "muster:"
>
> scope_guard g;
> if (a) g.dismiss();
> ...
> if (b) g.muster();
>
> A variation on "guard" (the verb) is "protect," which has the
> right meaning and avoids overloading the word "guard" to excess:
>
> scope_guard g;
> if (a) g.dismiss();
> ...
> if (b) g.protect();
>
> "Secure" is another choice.

I don't think we should concentrate on the human meaning of the word
"guard". The scope guard object doesn't protect or secure anything, so the
at_ease, attention, protect or secure do not reflect their semantic.

Once again, these two functions are supposed to change the state of the
object, nothing more. So their names should reflect this meaning.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk