Date: Mon, 24 Jun 2019 14:33:31 -0500
On Mon, Jun 24, 2019 at 10:37 AM Brian Bi via Std-Discussion <
std-discussion_at_[hidden]> wrote:
> The authors do not seem to have considered the possibility of having the
> mixed comparison operators throw an exception upon encountering a
> disengaged optional, but they did consider the possibility of having them
> simply cause a compilation error. We don't know why, but it seems to me
> that, if you really believe that this usage is almost always a bug, then
> you should want that bug to be caught at compile time. But it doesn't
> appear that the authors shared your view that it's almost always a bug.
> Instead, they claimed that some users of Boost.Optional found the mixed
> comparison operators useful.
>
You don't want your comparison operations to throw (for instance, it breaks
transparent comparisons aka less<void>, etc.) nor use exceptions to
indicate programming bugs (as those become indistinguishable from expected
behavior the developer is counting upon).
std-discussion_at_[hidden]> wrote:
> The authors do not seem to have considered the possibility of having the
> mixed comparison operators throw an exception upon encountering a
> disengaged optional, but they did consider the possibility of having them
> simply cause a compilation error. We don't know why, but it seems to me
> that, if you really believe that this usage is almost always a bug, then
> you should want that bug to be caught at compile time. But it doesn't
> appear that the authors shared your view that it's almost always a bug.
> Instead, they claimed that some users of Boost.Optional found the mixed
> comparison operators useful.
>
You don't want your comparison operations to throw (for instance, it breaks
transparent comparisons aka less<void>, etc.) nor use exceptions to
indicate programming bugs (as those become indistinguishable from expected
behavior the developer is counting upon).
-- Nevin ":-)" Liber <mailto:nevin_at_[hidden] <nevin_at_[hidden]>> +1-847-691-1404
Received on 2019-06-24 14:35:59