Boost logo

Boost :

Subject: Re: [boost] [variant2] Andrzej's review -- design
From: Emil Dotchevski (emildotchevski_at_[hidden])
Date: 2019-04-04 19:12:17


On Wed, Apr 3, 2019 at 11:56 PM Mike via Boost <boost_at_[hidden]>
wrote:
>
> > Going back to variant, in one case, we are defining an empty state,
> which
> > forces the user to provide explicit handling for that state,
> *everywhere*.
> You keep repeating that the user would have to explicitly handle that
> everywhere. I thought I just showed you that this is not the case.
> Except for visit, you don't have to explicitly handle the valueless
> state at all

Maybe you're thinking it's not a lot of work, but introducing a new state
in any type has overhead. Every time you touch a variant object, you must
consider the possibility of it being valueless. Your program must define
behavior for that case. You have to write unit tests for that behavior,
because people will be passing valueless variants when they shouldn't,
because they can.

But what's the upside? Why is the empty state preferable to another, valid
state? Either way we must define behavior, but in the latter case the
behavior is already defined, there is nothing to do.


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