|
Boost : |
From: Dave Abrahams (abrahams_at_[hidden])
Date: 2000-02-06 12:10:37
on 2/6/00 11:03 AM, Darin Adler at darin_at_[hidden] wrote:
> I think that the name "set_on_exit" gives the wrong emphasis.
>
> For similar reasons, I think that "auto_restore" is not such a good name
> either, despite what I said in my last message.
>
> I think of these objects as a way to safely set a variable to a value for a
> given scope. The fact that the variable is set back to the old value at the
> end of the scope is kind of a "detail of implementation", in a way.
but that's not what set_on_exit does. It ensures that when you leave a
scope, a variable has a particular value, not neccessarily the old value.
You know, I don't care that much what is decided. All I can say is that in
my experience, I've wanted to set a value on exit which is *not* the same as
the current value. I've also wanted to establish that a certain value will
be set on exit, but had no need to set a new value at the time that the exit
condition is established.
Maybe these are two separate, useful classes. I can definitely see the use
for auto_restore. It expresses something quite different, and though
arguably less flexible, possibly more generally useful.
-Dave
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk