220 29884 <20161217182130.GA4347@manuel-ThinkPad-L440.localdomain> article
Path: news.gmane.org!.POSTED!not-for-mail
From: Manuel Bergler <berglerma@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: New smart pointer: CopyConstructible and
 CopyAssignable flavor of unique_ptr
Date: Sat, 17 Dec 2016 19:21:30 +0100
Lines: 83
Approved: news@gmane.org
Message-ID: <20161217182130.GA4347@manuel-ThinkPad-L440.localdomain>
References: <e30ffb82-0d5f-fafd-39b4-28e60d07c948@gmail.com>
 <20161217141109.GA22645@manuel-ThinkPad-L440.localdomain>
 <b1c473be-03c1-e4db-f0c4-a23f182c7154@gmail.com>
 <CAFk2RUYmdj2HwRpP2HhY=xujkFP1e5LYKkg6eOGBOF_yE-3Lcg@mail.gmail.com>
 <3df7e8eb-01a0-7804-f476-504b5a25a9fe@gmail.com>
 <CAFk2RUaY3+MnXkmvaC=LxgRA_RD_XQpFfX-HT6X3iq1wD7ggCg@mail.gmail.com>
 <20161217170428.GA10214@manuel-ThinkPad-L440.localdomain>
 <20161217171633.4919375.58072.21574@gmail.com>
 <CAEddoJaAZkeJS9Maj2z0vYGnfuNnJZ+qFFdjeQyesTF5itJxHA@mail.gmail.com>
 <15884364-3238-41c7-bc5a-aa5595a64ade@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha256;
	protocol="application/pgp-signature"; boundary="82I3+IH0IqGh5yIs"
X-Trace: blaine.gmane.org 1481998939 8031 195.159.176.226 (17 Dec 2016 18:22:19 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sat, 17 Dec 2016 18:22:19 +0000 (UTC)
User-Agent: Mutt/1.5.24 (2015-08-30)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBDOZBAUFX4MRBWME23BAKGQEAIALA2Q@isocpp.org Sat Dec 17 19:22:14 2016
Return-path: <std-proposals+bncBDOZBAUFX4MRBWME23BAKGQEAIALA2Q@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-lf0-f69.google.com ([209.85.215.69])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBDOZBAUFX4MRBWME23BAKGQEAIALA2Q@isocpp.org>)
	id 1cIJcc-0001MV-5H
	for gclcip-std-proposals@m.gmane.org; Sat, 17 Dec 2016 19:22:14 +0100
Original-Received: by mail-lf0-f69.google.com with SMTP id b14sf16820534lfg.6
        for <gclcip-std-proposals@m.gmane.org>; Sat, 17 Dec 2016 10:22:19 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:subject:message-id:references:mime-version
         :content-disposition:in-reply-to:user-agent:x-original-sender
         :x-original-authentication-results:reply-to:precedence:mailing-list
         :list-id:x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=1cjFBRffW1EJTP0Iy6b9VN3otzfdAoWdn79xC5AzCQo=;
        b=tIw6/RUIaF/NL38BZKRyThfC80vHHUvIUZzjVlk3007pKRgiCiktqY2+Z5/UHeOgYp
         TMUdJ4Q4Qp+mgXPeyCZIvb1v+bwM3SUtfZYCRKUK0ZZfrlejElPtrZyIHbgAgDnKYBKK
         SL+JNGT0tkOcVM8eU+nd9QdO2GMNR1H1m7j/q9Sg0mo/E1V8cdRqKLllAo1MnBNzre1A
         yCfnph5KRtigjkH0Yb6vaGjpY6UhpylOMYWTJJbGqOBLGuWHsKBuNqbQ3UYFON/kIGkr
         MDtdLJutmVOH+NvGVBAkk61WhPHNuvquNiO0JUENiDx6rqHlTeP6IFY4n8REK4pNEP7t
         gl 
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:date:from:to:subject:message-id:references
         :mime-version:content-disposition:in-reply-to:user-agent
         :x-original-sender:x-original-authentication-results:reply-to
         :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post
         :list-help:list-archive:list-subscribe:list-unsubscribe;
        bh=1cjFBRffW1EJTP0Iy6b9VN3otzfdAoWdn79xC5AzCQo=;
        b=ruxrPsFW2iymdCeqfBKnRuleyzBIbfh0bf5E87pHZIoFmiMgpE4Ku90IlZu4MbDFbx
         3Dok46Evp5ELvyh2mDr4WgPk06w6l5zfK+w1cSyL/+wXJgbafl3aMW+DhjUUgMHaxdAz
         L2JyB/ehl6+X0DUhYUmA+D9lTYesv71melh7dHKInst3UAbLRbq/EjHK/haSActjhF6T
         8N3oNgdpoGa19TFMzJ8IVE2shRVXDZxYfc5ZuwARqXAH4B2ogdOqGfqZya4ub11wk3gj
         uG4DRkMMRe0FFqFAy+HeaESfVKUUf4IV0TX8FXUWDL9X0vcumrMzwSzf9umOTVbcW4mr
        
X-Gm-Message-State: AIkVDXKdIFQi3ZKmGp1rNoBa9+iihf76XfDguj+pDqwSCEt2Dosc1UsYuDhy3pfAN4wT7w==
X-Received: by 10.46.71.77 with SMTP id u74mr851639lja.14.1481998938855;
        Sat, 17 Dec 2016 10:22:18 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.28.196.140 with SMTP id u134ls704812wmf.22.gmail; Sat, 17 Dec
 2016 10:22:17 -0800 (PST)
X-Received: by 10.194.26.170 with SMTP id m10mr7597150wjg.152.1481998937465;
        Sat, 17 Dec 2016 10:22:17 -0800 (PST)
Original-Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com. [2a00:1450:400c:c09::242])
        by mx.google.com with ESMTPS id u10si12471734wjz.151.2016.12.17.10.22.17
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Sat, 17 Dec 2016 10:22:17 -0800 (PST)
Received-SPF: pass (google.com: domain of berglerma@gmail.com designates 2a00:1450:400c:c09::242 as permitted sender) client-ip=2a00:1450:400c:c09::242;
Original-Received: by mail-wm0-x242.google.com with SMTP id u144so11238044wmu.0
        for <std-proposals@isocpp.org>; Sat, 17 Dec 2016 10:22:17 -0800 (PST)
X-Received: by 10.28.41.5 with SMTP id p5mr8046703wmp.38.1481998936850;
        Sat, 17 Dec 2016 10:22:16 -0800 (PST)
Original-Received: from localhost (x5d856f73.dyn.telefonica.de. [93.133.111.115])
        by smtp.gmail.com with ESMTPSA id u81sm9051526wmu.10.2016.12.17.10.22.15
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
        Sat, 17 Dec 2016 10:22:16 -0800 (PST)
Content-Disposition: inline
In-Reply-To: <15884364-3238-41c7-bc5a-aa5595a64ade@isocpp.org>
X-Original-Sender: berglerma@gmail.com
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@gmail.com;       spf=pass (google.com: domain of
 berglerma@gmail.com designates 2a00:1450:400c:c09::242 as permitted sender)
 smtp.mailfrom=berglerma@gmail.com;       dmarc=pass (p=NONE dis=NONE) header.from=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:29884
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/29884>


--82I3+IH0IqGh5yIs
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sat, Dec 17, 2016 at 10:04:47AM -0800, Nicol Bolas wrote:
>
>   After all, such copying behavior won't break most standard library type=
s.
>   `vector<clone_ptr>` will work as expected, as will `any`,
>   `optional<clone_ptr>`, `variant<clone_ptr>`, and so forth.
>

It would certainly work with the STL types, but I'm fairly certain you migh=
t get very different results when using these in STL algorithms. With some =
implementations references to the pointees might be preserved since the alg=
orithm doesn't copy the clone_ptr whereas others might perform a copy, henc=
e invalidating existing references or at least having them point to a diffe=
rent object than the one returned from the algorithm.

>   I think it's important to understand that `clone_ptr` is a solution to =
a
>   very specific problem, one that isn't exactly common. You shouldn't see=
 a
>   huge number of these pointers lying around.

>   I don't think "might be harmful" is a good enough reason to not have th=
e
>   type.

Together with the fact that the problem it tries to solve isn't common it m=
ost
definitely is. If the type is very hard to use correctly and not really nee=
ded
all that often then I see no reason to have it.

>   I'd say the biggest problem is that there's no way to conceptualize the
>   special nature of `clone_ptr`'s copy constructor. You can't write a
>   Concepts TS `requires` clause that says, "a copy constructor/assignment
>   shall ensure that the copied value is =3D=3D to the original." That's a=
n
>   axiomatic distinction, not a syntactic one. And we don't have ways to
>   specify axioms or require based on them.

The problem really is that it tries to act both as a pointer type which wou=
ld entail that after copying it the pointee is the same for both pointers a=
nd at the same time it tries to be a object type where copying creates dist=
inct but equivalent instances.


--=20
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 e=
mail 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/20161217182130.GA4347%40manuel-ThinkPad-L440.loc=
aldomain.

--82I3+IH0IqGh5yIs
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEi3F6I6jTgMCHgGvofAJ3kFaTK3oFAlhVgigACgkQfAJ3kFaT
K3o5kg//RBZW6yvORLGqaaufJRCejB6cW7TkaKIFTZqCn539EYozX8zDfRd95fLA
BNrrDiavQRmEQk978bJ7fpb0ZAnrMaMZ1k7LPRd1jGw+YvnsOFzLYnhCMMqtIBhU
bfSwiIJHa1w3f7/znuHje2bywVupPXY1mA/1+MhOp4yaX98O4jTWjfEbYp9KGCKz
jF2vDkBl59fASGOC0TYiJ+zxjom0+5JZSvbb9Jsm0BTTRI+0x4DxHeS5F2N6S2Ix
iPdnRPxroiQ9k2uQfJbeJbz+IiEgKtNKjpz5P9QmAUEK5Z93C0W/RSfR6TKYQeWu
Wnne5EKOqrPTHRkib4DgZIwd2Soob3NAMKiNGTRsjPGJsIDvxJUFekhi1mnNYWA5
AknXsf4DNo2cmF0j5IW+q2NeliZYXLUdVWGePIRrsJ6C1plRDOrckOuEJSFDFuZr
W13SUPFlfalXLZyz2Bqz8k00wTI77Z4I7l4PnNZKnt+Qf6JHwu35LCYqfO3K4mbu
rQXJNb4QHwGkY7zXQnOmYgpOOB19hj+Z9+1kkOFTyHhpvOh0LDGkWLkONsIiKDmC
9qqFUDVqBi6WVN/Fg0UFvY0GmLmm6v8dIxwZByrCjWL7qJc/17S0xCi3Jbr0UNEI
x0QIg6M7zhHbb0fiK0lST+nbLXzkqXpqZIUXcNYeaiZssdNCiMo=
=KFjP
-----END PGP SIGNATURE-----

--82I3+IH0IqGh5yIs--

.
