$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] [variant2] Formal review
From: Gavin Lambert (boost_at_[hidden])
Date: 2019-04-14 23:48:03
On 15/04/2019 08:58, Emil Dotchevski wrote:
>> Yes, but the question was about the benefits of the never-empty
>> guarantee. If the never-empty guarantee doesn't help with maintaining
>> higher level invariants, then what benefit does it bring?
>
> If the design allows for one more state, then that state must be handled:
> various functions in the program must check "is the object empty" and
> define behavior for that case. The benefit of the never-empty guarantee is
> that no checks are needed because the object may not be empty.
As I've said elsewhere, I don't see the difference between "is this
empty" and "did this unexpectedly change type", except that the former
is easier to detect (and hence better).