Boost logo

Boost :

Subject: Re: [boost] [optional] Safe optional
From: Vladimir Batov (Vladimir.Batov_at_[hidden])
Date: 2014-11-18 19:55:51

On 11/19/2014 10:52 AM, Vicente J. Botet Escriba wrote:
> Le 18/11/14 22:35, Vladimir Batov a écrit :
> ...
>> 2. I find it troubling that you keep bringing "remove implicit
>> conversion from T " up. That indicates that the property is close to
>> the top of your "grievances" list. On my side, I find that implicit
>> conversion essential for sane interactions of users with "optional".
>> Back a while, when we were discussing "optional" (was it ISO forum?),
>> I remember Fernando Cacciola expressing the same opinion (and as
>> strongly). I'd greatly appreciate if you could please provide
>> practical usage/deployment examples where implicit conversion from T
>> causes a problem.
> It is about the pre-conditions. Before doing a conversion you need to
> ensure that there is a value. This give an if-the-else style that
> doesn't scale when you have several optionals in the game.

Hmm, aren't we talking about different conversions? I was referring to
"T to optional<T>". I have the feeling that you are referring to
"optional<T> to T". I've never been advocating the implicit latter.

>> ...
>> I have to admit I find it somewhat of a concern hearing from the
>> "optional" maintainer and someone leading "optional" for
>> standardization that he does not seem to share/agree with the current
>> "optional" design to the point where you are keen on forking a
>> "seriously incompatible" variant. Going ahead with the latter will be
>> a lot of effort implementing, promoting, educating, defending... IMO
>> that'll be the effort 1) not necessarily successful; 2) fragmenting
>> the user-base; 3) most importantly, it'll be the effort taken *away*
>> from the current "optional"... which seems so close (hopefully) to
>> standardization. If you have concerns (you would not initiate the
>> conversation if you did not), let's discuss them within the
>> "optional" boundaries and document/justify the decisions made. Do I
>> worry too much?
> Things are moving in C++ to the functional paradigm very quick. People
> would need to learn, soon or late, functional programming and
> monads. I'm sorry, they are viral !!!

You may well be right... Still, I would not be that quick and decisive
underestimating people's inertia. After all, functional programming
languages have been around much longer than C++. I do not see them
occupying minds of the programming majority. Even using primitive
functional programming in C++ (say, std::for_each instead of ol' and
trusty for loop) has not been exactly "viral". :-)

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