220 39436 <2a326be3-4a3d-466e-819f-56dbac65b620@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: Allow use of "->" when operator* presents
Date: Sat, 28 Jul 2018 22:12:54 -0700 (PDT)
Lines: 87
Approved: news@gmane.org
Message-ID: <2a326be3-4a3d-466e-819f-56dbac65b620@isocpp.org>
References: <53f13047-62e7-4b31-ab7d-f3134e15eb08@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_1560_851785953.1532841174290"
X-Trace: blaine.gmane.org 1532841050 27472 195.159.176.226 (29 Jul 2018 05:10:50 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sun, 29 Jul 2018 05:10:50 +0000 (UTC)
Cc: junekey91@gmail.com
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCEKFTV6ZUMBBV4Z6XNAKGQEPAIPOKY@isocpp.org Sun Jul 29 07:10:46 2018
Return-path: <std-proposals+bncBCEKFTV6ZUMBBV4Z6XNAKGQEPAIPOKY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-yb0-f198.google.com ([209.85.213.198])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCEKFTV6ZUMBBV4Z6XNAKGQEPAIPOKY@isocpp.org>)
	id 1fjdyf-00071X-U0
	for gclcip-std-proposals@m.gmane.org; Sun, 29 Jul 2018 07:10:46 +0200
Original-Received: by mail-yb0-f198.google.com with SMTP id a12-v6sf5026909ybe.21
        for <gclcip-std-proposals@m.gmane.org>; Sat, 28 Jul 2018 22:12:57 -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:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe;
        bh=q1VELVmiucW6w3KIVOOfIWljSzy4NHqfeHglkiJTIoc=;
        b=afjs4IIoXDSNZdgQQvoa97gWfxQSfuB4rp80f/67n5CBRJA+aSTZ/WL77vUboQansx
         VbF4g9iO6x/nB2RpR7nRlkeNJPIqxvhOf+riRP4cVoB56NxVT1JaZH2pkXKNZ2jjI2bu
         Bvo3J3K4Q7tPDnENFJhia1YNORMt0enMlTnz666LG5zZgqVAmavSAGDY/Zx4ZWgOQFSn
         aWDtvWghTvtJZ+errlJT2gypCjR9PEp2KKFWv5dOVA8zKQB+1rkyo2W3VF730RJKpRSO
         1mPwz/Y551pN6I5/YdhyMTuDM0Z8ummcSseD5E9Q5GOZScgv5OJ7gpWYSHd+hFRs9ZYP
         t7xg==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20161025;
        h=date:from:to:cc:message-id:in-reply-to:references:subject
         :mime-version:x-original-sender:reply-to:precedence:mailing-list
         :list-id:list-post:list-help:list-archive:list-subscribe
         :list-unsubscribe;
        bh=q1VELVmiucW6w3KIVOOfIWljSzy4NHqfeHglkiJTIoc=;
        b=YwpOdOV5MNhAzlbx799Nn9vV1BE2MxCOvwwpLfwdwTVuCqt1ip6Klg4VHDSDyWNHVk
         iEm5zJ32id/6z93Oj/Y4rPP4UPjkJeMdzvtVOeyI0rZW8h35WnOiPndYBENhLidUmKt7
         tBPmPIEyzh5ytomgG5pN0pihm/dLpeo3XhFVqhbl6DZw0TLGoSpP9CbZoJQboHEjb2gT
         6pvZmpRzZbVa9W3lFDJ1kzfN+HVe2Qn3zV/zW8/NGoVIqjm+uuDTAs/Ft4UPBQ1BIf2R
         0qIf5jtd2GnFXpd2NFRtZIDc4JSww4fiRSyhUCEQdNJJDUMW+SS8uf6ck4bO8a+slZSs
         RgrA==
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: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=q1VELVmiucW6w3KIVOOfIWljSzy4NHqfeHglkiJTIoc=;
        b=p/Aqsvw6IoEIenJH0TRQF0E+zvc6sMcWeWD/wflOtd0cQBCbIVz5f6pqn1TPl3iWw/
         pmG/8vCoYNVKGTO5xXn/0GlXKbkx3jMUCqtPJO6mOE4bNduW/khTNilR7Y/2z2Yg7jOD
         Dp0ElclO7uJ7302VGeE+yvvcHCaP5wZkwj7jLpdCBnDkzVJxDA6eFs2kp1e9/eq2++/U
         U59dcXCruhBATzEj8B3WV8+ORNM4ZHOp6uOcUQvosumofG/j3sBKZ8Dd7Bpx0HF64kic
         b2bribQClPJYTC+6x/BY5Wf69GBYEBStsajYPvEYNpUh/sNc2kHaZCdcLT9v3UEFsz5I
         yhJA==
X-Gm-Message-State: AOUpUlEcS+fCDUYacr8c62gOn1n4/1zRdJ6J4nvk4/CDU8TbD4/BuHW/
	GrZ6vjtGM1o8bkqK2rFcfHUwWw==
X-Google-Smtp-Source: AAOMgpeDmvjIp0qqUiS2+2TIfQDWFUFJuBnlgrDTXaLU5C7NwQdGJOSCEkIu1RYBwy/BSzLUU6zjXA==
X-Received: by 2002:a5b:b4a:: with SMTP id b10-v6mr3719630ybr.33.1532841176541;
        Sat, 28 Jul 2018 22:12:56 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 2002:a25:5502:: with SMTP id j2-v6ls1692457ybb.7.gmail; Sat, 28
 Jul 2018 22:12:55 -0700 (PDT)
X-Received: by 2002:a25:8448:: with SMTP id r8-v6mr124554ybm.2.1532841174910;
        Sat, 28 Jul 2018 22:12:54 -0700 (PDT)
In-Reply-To: <53f13047-62e7-4b31-ab7d-f3134e15eb08@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-Spam-Checked-In-Group: 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:39436
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/39436>

------=_Part_1560_851785953.1532841174290
Content-Type: multipart/alternative; 
	boundary="----=_Part_1561_923636987.1532841174290"

------=_Part_1561_923636987.1532841174290
Content-Type: text/plain; charset="UTF-8"

On Saturday, July 28, 2018 at 5:56:18 PM UTC-4, june...@gmail.com wrote:
>
> The main motivation is that the language rule requires us to (eventually) 
> return raw pointers in operator->.


There's another motivation: Concepts and `operator->` don't mix.

The current iterators in the Range TS/C++20 don't require `operator->`. One 
of the reasons for this is that it's actually very hard to specify that 
behavior via an expression. After all, `->` has to be followed by a member 
name, and what if a template type doesn't have members? Overall, there's 
not a simple way to check that `operator->` exists. By contrast, it's easy 
to have `{*it} -> some_type;` in a requires clause.

Of course, we can still have our iterators provide an `operator->`. And 
since there is no concept checking of implementations, the implementation 
of a function that takes a Range TS iterator can still invoke `operator->`, 
which will work with the existing iterators.

If we just say that we can synthesize an `operator->` if `operator*` 
exists, then we don't have a problem. Concepts can just require `operator*` 
using appropriate requirements, and the behavior of any usage of `->` is 
expected to conform to the return value from `operator*`. The 
implementation of a concept can use `->` when it is appropriate, and 
everyone is happy.

-- 
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/2a326be3-4a3d-466e-819f-56dbac65b620%40isocpp.org.

------=_Part_1561_923636987.1532841174290
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Saturday, July 28, 2018 at 5:56:18 PM UTC-4, june...@gm=
ail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-l=
eft: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">The main motivat=
ion is that the language rule requires us to (eventually) return raw pointe=
rs in operator-&gt;.</blockquote><div><br></div><div>There&#39;s another mo=
tivation: Concepts and `operator-&gt;` don&#39;t mix.</div><div><br></div><=
div>The current iterators in the Range TS/C++20 don&#39;t require `operator=
-&gt;`. One of the reasons for this is that it&#39;s actually very hard to =
specify that behavior via an expression. After all, `-&gt;` has to be follo=
wed by a member name, and what if a template type doesn&#39;t have members?=
 Overall, there&#39;s not a simple way to check that `operator-&gt;` exists=
.. By contrast, it&#39;s easy to have `{*it} -&gt; some_type;` in a requires=
 clause.<br></div><div><br></div><div>Of course, we can still have our iter=
ators provide an `operator-&gt;`. And since there is no concept checking of=
 implementations, the implementation of a function that takes a Range TS it=
erator can still invoke `operator-&gt;`, which will work with the existing =
iterators.</div><div><br></div><div>If we just say that we can synthesize a=
n `operator-&gt;` if `operator*` exists, then we don&#39;t have a problem. =
Concepts can just require `operator*` using appropriate requirements, and t=
he behavior of any usage of `-&gt;` is expected to conform to the return va=
lue from `operator*`. The implementation of a concept can use `-&gt;` when =
it is appropriate, and everyone is happy.<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/2a326be3-4a3d-466e-819f-56dbac65b620%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/2a326be3-4a3d-466e-819f-56dbac65b620=
%40isocpp.org</a>.<br />

------=_Part_1561_923636987.1532841174290--

------=_Part_1560_851785953.1532841174290--

.
