Subject: Re: [boost] [optional] Thoughts on disallowing assignment for wrapped references.
From: Mostafa (mostafa_working_away_at_[hidden])
Date: 2011-09-03 22:55:57
On Thu, 01 Sep 2011 07:19:05 -0700, Nevin Liber <nevin_at_[hidden]>
> On 1 September 2011 04:28, Mostafa <mostafa_working_away_at_[hidden]>
>>> I see the same thing as all of the other cases, the "exactly 1 time"
>>> is relaxed into "0 or more times".
>> Ahh, I disagree with that.
> That may be, but you haven't shown a flaw in my reasoning. I contend
> that in the normal lifetime window, both objects and references exist
> "exactly 1 time". Where is that reasoning inconsistent?
I'm not disagreeing with your above comment, rather I'm disagreeing with
>> IMO, if maybereff was not bound at construction
>> time, then it should always remain "uninitialized".
> You are arguing for "at most once where lifetime begins at the point
> of construction of the optional<U&>"? Why not argue the same for
> objects? I don't see the difference, other than you want to introduce
> a difference.
Because for optional<T&>, and only for optional<T&>, the semantics of the
assignment operator differs from the semantics of the assignment operator
of its underlying type, namely T&. (Hence the reason for me wanting to
explore disallowing the assignment operator for optional<T&>.)
>> Now Fernando has made an interesting case for
>> why disallowing the assignment operator for optional<T&> and allowing
>> it for
>> all other types is bad.
> He is arguing for consistency. So am I.
Aren't we all? But there are differing notions of consistency floating
around. I'm motivated by consistency for the assignment operator of
optional<T&>, Fernando's motivated by consistency of programming w.r.t. to
template programming and use of optional in general. And as Fernando
pointed out, it may not be possible to satisfy all these notions
simultaneously. My thought was, and continues to be that if all these
notions of consistency can't be satisfied simultaneously, then instead of
satisfying some fully and others partially, why not just disallow those
operations that are partially consistent. Or more specifically, what are
the implications of just disallowing those operations that are partially
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk