Boost logo

Boost :

Subject: Re: [boost] [atomic] (op)_and_test naming
From: Peter Dimov (lists_at_[hidden])
Date: 2018-01-25 23:59:52


Frank Mori Hess wrote:

> I haven't been following this specific discussion closely, but in general,
> I wish designers put a higher value on consistency than on trying to guess
> what the audience's expectations are. Consistency leads to tools whose
> behavior can be reasoned about and competence with can be achieved.
> Guessing what the people want leads to incomprehensible black boxes that
> the user pokes at, hoping it will guess what they want it to do.

The specific situation under discussion is as follows:

1. Andrey has provided a function x.sub_and_test(v) which returns true when
the result is zero.
2. Gavin argues that it should return true when the result is not zero.
3. I say that the function should be x.sub_and_test_if_zero(v) which returns
true when the result is zero.

In (1), Andrey has provided the function as it is not because this is his
guess of what people want, but because true on zero feels more natural as
it's much more common to test for zero than to test for nonzero after
subtraction. (Not so after a bitwise operation, admittedly.)

In (2), Gavin argues for true on nonzero not because this is what people
want, but because of consistency.

In (3), I suggest the rename not because this is what people want, but
because I want to remove the ambiguity and the need to guess.


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