220 28951 <986ffd0c-7466-476a-96af-525aaf8b24ea@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Nicol Bolas <jmckesson@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Re: Is World's Dumbest Pointer still on the table?!?
Date: Tue, 18 Oct 2016 13:09:48 -0700 (PDT)
Lines: 141
Approved: news@gmane.org
Message-ID: <986ffd0c-7466-476a-96af-525aaf8b24ea@isocpp.org>
References: <8a6731f7-1c9b-482d-817e-c2374fc9ae1b@isocpp.org>
 <nu53qp$lvv$1@blaine.gmane.org> <7d817482-e7c3-4724-9501-738d4c9083d7@isocpp.org>
 <CAFk2RUYggLMwivpFr+thZmRBUXBgXC283iwAvyRQEnbT7xrqUA@mail.gmail.com>
 <f3d2848e-56f7-4ddd-a0a0-1a8c7b8db391@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_1563_1074292619.1476821388357"
X-Trace: blaine.gmane.org 1476821416 9944 195.159.176.226 (18 Oct 2016 20:10:16 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Tue, 18 Oct 2016 20:10:16 +0000 (UTC)
Cc: mihailnajdenov@gmail.com
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCEKFTV6ZUMBBDUDTLAAKGQEXCBFWKI@isocpp.org Tue Oct 18 22:10:12 2016
Return-path: <std-proposals+bncBCEKFTV6ZUMBBDUDTLAAKGQEXCBFWKI@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yw0-f200.google.com ([209.85.161.200])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCEKFTV6ZUMBBDUDTLAAKGQEXCBFWKI@isocpp.org>)
	id 1bwahq-000840-6L
	for gclcip-std-proposals@m.gmane.org; Tue, 18 Oct 2016 22:09:50 +0200
Original-Received: by mail-yw0-f200.google.com with SMTP id 9sf8239230ywa.7
        for <gclcip-std-proposals@m.gmane.org>; Tue, 18 Oct 2016 13:09:52 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:cc:message-id:in-reply-to:references:subject
         :mime-version:x-original-sender:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=dAzVVun+vWZVxVC6I/Ma5Xi3R6QjW+AnukD/2O3PrNo=;
        b=clOt5se3iw+lwqqY7iF5jlFwWZ55DaqfLUZNkNNwjtnurKFa5h2qRDPTeS04ruqTq1
         0Cu5UhAgriTP1+6G4ZnCmwzAlEcBfkIqyo5FBBbdnzsG2MGtQi24enc073GOD9yRTdKZ
         aV34IuEvknPS6rPZtlUl2q/5ohMoYZpSlsFWqlZCyTbI6P1Lmtm9+fOEsFpdB4DsOl4U
         8ZAALB+DAP1t7CaBWg3fThHnwLBWJkkM0JuA2cApM6ZIPfHM5u+yTzenWZH8X5kXb25I
         hDatDJ536RaePHFViUWcM5gX8ucR9mE9q8h3tAGOXlrY+h8JyYI3MJCyi8s9ShwjzA1z
         IBXg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to:cc:message-id:in-reply-to:references:subject
         :mime-version:x-original-sender:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=dAzVVun+vWZVxVC6I/Ma5Xi3R6QjW+AnukD/2O3PrNo=;
        b=N0Bm6NtAD28yHbKo6Mt9Ypi+SI3aOrsqLJ/wIqOMLQ+IwMA1ljpfiyPyB/7TfRRNr2
         lJahR0Y1t0NNpVxafyMT0P+EDR2SQ9fKkD15nUVPf47mlTaMQNioUmnEZIpMmqXorh8Z
         wXl3o58LAgr5+C2sxjwlEISm5pFxrfA2N+mi5hYcQQFoJcNxW4q2UoPNdKzuY1kmsqN6
         VWSUA/NQI9jquIMyliQdgk27HO4Pd7acFY9/izq8q0MEoVRYnqZUjJbkJ+dK/+lE00hA
         QQBKTsClodOVDexfPWAn+UyAdMVo3I5Y37IPqQc3yy4boHx48YZruIXZXGulmsiog+Ht
         kdlw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:date:from:to:cc:message-id:in-reply-to
         :references:subject:mime-version:x-original-sender:reply-to
         :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=dAzVVun+vWZVxVC6I/Ma5Xi3R6QjW+AnukD/2O3PrNo=;
        b=gsdd528sBFgWUV1EkT91wgbaURdPRsYvVs8RUXVkk8r/on9pN+jWa1CIiRIYtodkIZ
         W2J7lKykcqVxnxNNqiBEKy8RGH15UNsi3et6QdRklSXjb+XJX9fBZtyCU0lm0JvrNoKi
         5Symi7ugk56ezt3z5CJx8X6bRUOMFylYOgrByz0CVc1wizBWC7BZVDF6Wx8NMrO8AEvx
         4UIHSj8w0R0aJi7Khs+cqQRe6vaLMjB3PeJjTOrAgWt+toKb8H+SFqlL95jre7GWjgIu
         CGAOpq9QefCdiXSsZ0YwL3gFEHBmYNdlyJPwKzPJkfrxV98aicAgXekuPw4WVJbVXwe9
         qHng==
X-Gm-Message-State: AA6/9RmRIRGex7aurqg9H2YzA1VLgxlx/oEZsz7B1AmrcnY/DoCafSCwBHVGzIsrTuwVpg==
X-Received: by 10.129.90.196 with SMTP id o187mr729836ywb.141.1476821392193;
        Tue, 18 Oct 2016 13:09:52 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.6.67 with SMTP id 64ls229789iog.53.gmail; Tue, 18 Oct 2016
 13:09:50 -0700 (PDT)
X-Received: by 10.36.65.22 with SMTP id x22mr403666ita.1.1476821390067;
        Tue, 18 Oct 2016 13:09:50 -0700 (PDT)
In-Reply-To: <f3d2848e-56f7-4ddd-a0a0-1a8c7b8db391@isocpp.org>
X-Original-Sender: jmckesson@gmail.com
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:28951
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/28951>

------=_Part_1563_1074292619.1476821388357
Content-Type: multipart/alternative; 
	boundary="----=_Part_1564_2015910521.1476821388357"

------=_Part_1564_2015910521.1476821388357
Content-Type: text/plain; charset=UTF-8

On Tuesday, October 18, 2016 at 9:44:40 AM UTC-4, mihailn...@gmail.com 
wrote:
>
> On Tuesday, October 18, 2016 at 4:17:29 PM UTC+3, Ville Voutilainen wrote:
>>
>> On 18 October 2016 at 16:08,  <mihailn...@gmail.com> wrote: 
>> > In any case, for a smart pointer, reset and release are lifetime 
>> management 
>> > interfaces. 
>> > 
>> > observer_ptr changes this. 
>>
>> But yet its users are unlikely to find this a problem, because some of 
>> them don't consider 
>> reset and release to be lifetime management interfaces. 
>>
>
> reset and release is lifetime interface in the context of a smart pointer 
> -  if you touch these, the lifetime of the object will change. 
> That's a fact, not a point a view.
>

No, it is a point of view.

To hold onto a smart pointer object means that you expect the object 
pointed to by the smart pointer to continue to exist, pursuant to the smart 
pointer's contract. A `weak_ptr` does not ensure the lifetime of the 
pointed-to object. What it does ensure is that, if that lifetime has ended, 
you'll know about it. You may get a NULL pointer, but you'll never get an 
invalid one.

When you `reset` a smart pointer, you are saying that you no longer expect 
that object to exist. Whether or not it is actually destoryed is 
smart-pointer specific. `shared_ptr::reset` doesn't guarantee the object 
will be destroyed. `weak_ptr::reset` doesn't destroy anything at all.

By calling `reset`, you are making a contract with the smart pointer. From 
that point forward, you will not do anything to access the object 
referenced by that smart pointer, nor any object who's lifetime depends on 
it, *unless* you have a guarantee from some other object. That is, as far 
as this particular smart pointer is concerned, it is not going to ensure 
anything.

`release` isn't even a function that most smart pointers have.

observer_ptr pretends to be smart with risk of being harmful and/or 
> confusing. 
>

To whom is it harmful or confusing? Are you actually trying to claim that 
someone is going to assume that a smart pointer with the word "observer" in 
it is going to manage memory?

Anyone who does that *deserves* what they get.

The point of `observer_ptr` is to represent when a function is being given 
a pointer it does not have ownership of.

-- 
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/986ffd0c-7466-476a-96af-525aaf8b24ea%40isocpp.org.

------=_Part_1564_2015910521.1476821388357
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Tuesday, October 18, 2016 at 9:44:40 AM UTC-4, mihailn.=
...@gmail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;mar=
gin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D=
"ltr">On Tuesday, October 18, 2016 at 4:17:29 PM UTC+3, Ville Voutilainen w=
rote:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;=
border-left:1px #ccc solid;padding-left:1ex">On 18 October 2016 at 16:08, =
=C2=A0&lt;<a rel=3D"nofollow">mihailn...@gmail.com</a>&gt; wrote:
<br>&gt; In any case, for a smart pointer, reset and release are lifetime m=
anagement
<br>&gt; interfaces.
<br>&gt;
<br>&gt; observer_ptr changes this.
<br>
<br>But yet its users are unlikely to find this a problem, because some of
<br>them don&#39;t consider
<br>reset and release to be lifetime management interfaces.
<br></blockquote><div><br></div><div>reset and release is lifetime interfac=
e in the context of a smart pointer -=C2=A0 if you touch these, the lifetim=
e of the object will change. </div><div>That&#39;s a fact,=C2=A0not a point=
 a view.</div></div></blockquote><div><br>No, it is a point of view.<br><br=
>To hold onto a smart pointer object means that you expect the object point=
ed to by the smart pointer to continue to exist, pursuant to the smart poin=
ter&#39;s contract. A `weak_ptr` does not ensure the lifetime of the pointe=
d-to object. What it does ensure is that, if that lifetime has ended, you&#=
39;ll know about it. You may get a NULL pointer, but you&#39;ll never get a=
n invalid one.<br><br>When you `reset` a smart pointer, you are saying that=
 you no longer expect that object to exist. Whether or not it is actually d=
estoryed is smart-pointer specific. `shared_ptr::reset` doesn&#39;t guarant=
ee the object will be destroyed. `weak_ptr::reset` doesn&#39;t destroy anyt=
hing at all.<br><br>By calling `reset`, you are making a contract with the =
smart pointer. From that point forward, you will not do anything to access =
the object referenced by that smart pointer, nor any object who&#39;s lifet=
ime depends on it, <i>unless</i> you have a guarantee from some other objec=
t. That is, as far as this particular smart pointer is concerned, it is not=
 going to ensure anything.<br><br>`release` isn&#39;t even a function that =
most smart pointers have.<br><br></div><blockquote class=3D"gmail_quote" st=
yle=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-lef=
t: 1ex;"><div dir=3D"ltr"><div></div><div>observer_ptr pretends to be smart=
 with risk of being harmful and/or confusing. </div></div></blockquote><div=
 dir=3D"ltr"><br>To whom is it harmful or confusing? Are you actually tryin=
g to claim that someone is going to assume that a smart pointer with the wo=
rd &quot;observer&quot; in it is going to manage memory?<br><br>Anyone who =
does that <i>deserves</i> what they get.<br><br>The point of `observer_ptr`=
 is to represent when a function is being given a pointer it does not have =
ownership of.<br></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/986ffd0c-7466-476a-96af-525aaf8b24ea%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/986ffd0c-7466-476a-96af-525aaf8b24ea=
%40isocpp.org</a>.<br />

------=_Part_1564_2015910521.1476821388357--

------=_Part_1563_1074292619.1476821388357--

.
