Mark Mitchell <[EMAIL PROTECTED]> wrote:

> IMO, if these are C++-only, it's relatively easy to deprecate these
> extension -- but I'd like to hear from Jason and Nathan, and also the
> user community before we do that.  Of all the extensions we've had, this
> one really hasn't been that problematic.

I would prefer them to stay. My reasons:

1) std::min() and std::max() are not exact replacements. For instance, you
cannot do std::min(3, 4.0f) because the arguments are of different type.
Also, you cannot use reference to non-const types as arguments. The min/max
exensions do not suffer from these problems (I consider the former very
problematic, and the latter just annoying).

2) The min/max assignments are very useful. I'm speaking of the
(undocumented?) ">?=" and "<?=" operators. They save much more typing. For
instance, I use:

for (int i=0; i<100; i++)
    max_computed >?= Compute(i) * factor;

instead of:

for (int i=0;i<100;i++)
{
     float cur = Compute(i) * factor;
     if (max_computed < cur)
        max_computed = cur;
}

I find the former more compact, more expressive and much easier to read (of
course, you have to know to syntax). I find it also less error-prone since
there is no duplication, nor the use of a variable to prevent side-effects.
I suppose that if we drop ">?" and "<?", we are also going to drop ">?=" and
"<?=", this is why I'm giving arguments for both.

In fact, I find the min/max assignment operators so useful that I would even
propose it for standardization.
-- 
Giovanni Bajo

Reply via email to