Boost logo

Boost :

Subject: Re: [boost] [variant2] Andrzej's review -- design
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2019-04-04 00:40:29

On Wed, Apr 3, 2019 at 2:08 AM Mike via Boost <boost_at_[hidden]> wrote:
> Mabye I'm blind, but it seems to me that people repeatedly mix up
> "never empty" and "no error state".
> Variant2 can still get into an error state, just that that error state is
> explicitly named and modeled as part of variant2, but instead, a "regular"
> state is reused to signal that error:

What you're missing is that this is a matter of definition.

Your definition is: if we enter a state because of an error, then that
state is an error state.

An alternative definition is: if an assignment operation fails, the object
is left in an unspecified but valid state.

Under the second definition, it is illogical to call the "unspecified but
valid" state an error state that must be checked, because by definition it
is a perfectly valid state. Further, this valid state is not "reused to
signal that error". It is the result of the error, but the error is
communicated by other means, e.g. an exception.

Boost list run by bdawes at, gregod at, cpdaniel at, john at