|
Boost : |
Subject: Re: [boost] [optional] Safe optional
From: Vladimir Batov (Vladimir.Batov_at_[hidden])
Date: 2014-11-18 16:35:09
Andrzej,
On 11/18/2014 08:23 PM, Andrzej Krzemienski wrote:
> ...
> And to remove operator* and get() and value() and get_pointer() -
> anything that could cause UB. And remove implicit conversion from T
1. I might be open to the idea of unifying/cleaning the access interface
and settling on one... but taking them *all* out?.. Or you want to keep
operator->()? Then, I still can do
optional<T> ot;
T* t = ot.operator->();
You might say, it's crazy. My point is that if you want to save me (the
user) from myself with "safe optional", you are most likely wasting your
effort -- an uneducated idiot will always find a way to hurt himself.
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.
>> In
>> that case why not add it to the regular optional?
>>
>> IMHO, in order to introduce an alternative component, there should be
>> significant and incompatible design and interface differences between
>> the two. So far I don't see the need for such differences.
>>
> As explained above: serious backwards incompatibility. Unacceptable by
> many, including myself.
>
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?
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk