220 33119 <CAPCFJdSzcO6_4fWYE6SjDpTKTuU1NsGdZCmMzEVJF=Lajvgpew@mail.gmail.com> article
Path: news.gmane.org!.POSTED!not-for-mail
From: =?UTF-8?Q?Micha=C5=82_Dominiak?= <griwes@griwes.info>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Struture dereference operator as fallback for
 missing structure reference
Date: Wed, 05 Jul 2017 07:28:04 +0000
Lines: 140
Approved: news@gmane.org
Message-ID: <CAPCFJdSzcO6_4fWYE6SjDpTKTuU1NsGdZCmMzEVJF=Lajvgpew@mail.gmail.com>
References: <e2d61492-c318-46b1-89e1-94f9697875dd@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary="94eb2c18a42e81e83105538cf192"
X-Trace: blaine.gmane.org 1499239698 23507 195.159.176.226 (5 Jul 2017 07:28:18 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Wed, 5 Jul 2017 07:28:18 +0000 (UTC)
To: "ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCA6D5ULVYBRBENK6LFAKGQEG453LLQ@isocpp.org Wed Jul 05 09:28:14 2017
Return-path: <std-proposals+bncBCA6D5ULVYBRBENK6LFAKGQEG453LLQ@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-io0-f198.google.com ([209.85.223.198])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCA6D5ULVYBRBENK6LFAKGQEG453LLQ@isocpp.org>)
	id 1dSejN-0005qx-3P
	for gclcip-std-proposals@m.gmane.org; Wed, 05 Jul 2017 09:28:13 +0200
Original-Received: by mail-io0-f198.google.com with SMTP id f66sf129725294iof.10
        for <gclcip-std-proposals@m.gmane.org>; Wed, 05 Jul 2017 00:28:18 -0700 (PDT)
ARC-Seal: i=2; a=rsa-sha256; t=1499239698; cv=pass;
        d=google.com; s=arc-20160816;
        b=lkI9Ye+8BtQl+ofIw17SoIDHHLmFZM8kw4gLB16/9GJQDURQ4Af41Sl//DIBZqvDXr
         GWxrzbR+AhEvv3WPUWYWJjQZogVI2wIWZW46lYJZOrf81Up/hs17ZDgGN244hin4RKRk
         348oSimCAveN4VhbQ2IGTxl1kWOFjFsfl5MrPNs1DjoI6XQWkUydU2vkx5dhOjWvcJ/R
         yjkPUbDiFY8u+NA3VEV0vTCwWnfGPfU9ip6lf34XmnIx55VDPnQwph5UAVboWxfndQs5
         AICxhl0RYZeV4if+GIKqBjfJtUli62mnhPIZXAQu8eiWkrpAfkM/oL66ftjr7BFmDj/a
         zqrQ==
ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post
         :list-id:mailing-list:precedence:reply-to:to:subject:message-id:date
         :from:in-reply-to:references:mime-version:arc-authentication-results
         :arc-message-signature:dkim-signature:arc-authentication-results;
        bh=3u9J7fwAQmFaLocQyEd6UAy07TeG8aIWOdpRtjpQM3I=;
        b=cYaI9/L1yPInqQF5NgmK0DIN3lC9Vip13uSLy120NwappbqjgCgBWr5jzdWlnnRk7q
         Ed+c+NLFg0yORosJ30LtPzxh6qCb1tc03Hd0PxBYI/4FM4bp+c64jebS5PBAGmgYUcqi
         dpDLfHq1rdDJ1KeMv38n6yvhWEU7sbg83t7EjkYb3GFaTmghpPBm2AS8dtjIA4/MRtA8
         KpTm7Cc9vzOTj4HoJyknOUurtHlXUVNqaVzIglW3VI8f68GmDeVcy0NH8SI4a0PX223G
         AfRGEyXnqC7nD4ZnWJITEu3dsccSJ9bRmrra0J5qt1/HamQjdIpxZ2IrZ7Vze4rdiSUP
         E8fQ==
ARC-Authentication-Results: i=2; mx.google.com;
       dkim=pass header.i=@griwes-info.20150623.gappssmtp.com header.b=VQx+r4/R;
       spf=neutral (google.com: 2607:f8b0:400e:c05::230 is neither permitted nor denied by best guess record for domain of admin@griwes.info) smtp.mailfrom=admin@griwes.info
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=mime-version:references:in-reply-to:from:date:message-id:subject:to
         :x-original-sender:x-original-authentication-results:reply-to
         :precedence:mailing-list:list-id:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=3u9J7fwAQmFaLocQyEd6UAy07TeG8aIWOdpRtjpQM3I=;
        b=VqlcJYYdF2dCPvzagYsYcWltIa8j1VMZ4wNrjdfaCkR0PAh2doNqHR4DzkLzTpTSho
         oybeviLqlI8fgWudN5mJcwQsprkiF55sOZEDmAWVVXoUoxl5xP0AT8Y7F28okUeSrQG9
         f2esxXaSGTd4N6jB7EpSDgvnOdDWNtJUxmJHhuQaZt7ANFGxY9vyZ9MbvbbccHIo4O2Q
         VbSS4VX4GgCeYA8CA9oGUIBjYAIMRr0XwWz/bHYaHa/tTn4WFLXlx8agixBxCTEyojKL
         fnlRA4qmSq61BGGTuGd5uU865vSzaWbPuOP3U0iFKzSt92zEhBHlD5zIZtIVABVP8pAI
         Q/hA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:mime-version:references:in-reply-to:from:date
         :message-id:subject:to: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=3u9J7fwAQmFaLocQyEd6UAy07TeG8aIWOdpRtjpQM3I=;
        b=sF/oNu+DaTWzNZJia01TqxhZDi+v55XinMjF1ze/khfVQ4nB31+MPSwWVBahIQz+Ph
         vra5VXy//Z7bYd+aWKWHfBKk1YkesB104HC+BoUvB2hmt7Jn443kVPU3UobcER9D7dpM
         izxnsmLl6Mc0ALODAit+vTm8H9wZEm/V0ibl9KLmg243rI5tRxQYX7qEoriWrRefdcEb
         jqfv5ll9cHvrPo4hZiw0uTNhUSqD0ZhwcBu5+FVjRHJmxF1iYEeeL8quVpCksOcMxfCk
         4VGWH+D6qItTMXBeZkANLl9usMnlm0k9NgMAsDIlBFCYFa7p3gWvY2Rb3QG79RH8z1n/
         EzdA==
X-Gm-Message-State: AKS2vOzZrLk/b7+gWG87D03sLD2PLRnFeajE5NAhnD3S9eC3brTf1FWW
	+FFv9UjZnmZ98A==
X-Received: by 10.107.183.9 with SMTP id h9mr27888230iof.36.1499239698381;
        Wed, 05 Jul 2017 00:28:18 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.36.122.208 with SMTP id a199ls2037263itc.5.gmail; Wed, 05 Jul
 2017 00:28:16 -0700 (PDT)
X-Received: by 10.84.215.150 with SMTP id l22mr6393688pli.29.1499239696791;
        Wed, 05 Jul 2017 00:28:16 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1499239696; cv=none;
        d=google.com; s=arc-20160816;
        b=dw8cUYSyp2o8odIvScZ1JDaEyaixPJ2qQLqnFLPYisZ4nngd6J4X89A+fXaT4aQSI+
         Onf9WFUIfWn4SS0twVOSDN+qvLDuqJ4PtReJRppD5srnlOmbK18dDNY2WRcHIaSOgZbn
         9SVEvH88ditGbVCx0zikxhmmLwE41JHYH++XR4cnInArJV7X/cvx5KO9tPzD7L5R/cXM
         xLfuY7yP+4gNka0Rpq9wN6EH2cALwh4OO1YWSU7aZMP4zqeLoaaReAJF4RtHotwFghfP
         jvBULwMV2iaGrkpwcdc+PZZvZq9ZSSu6Yq/0JKO/aP8iHGsegolPfNs+hjcx20Sr9hsa
         COMg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816;
        h=to:subject:message-id:date:from:in-reply-to:references:mime-version
         :dkim-signature:arc-authentication-results;
        bh=fs0Cf0Gq1MSUhNVgC+xiQNjIftOLtPx8CzPihF07Ai8=;
        b=BBv/Tgjh3LssWfVNLwNhbcz+6rA4ya/0xBPKn5NqbnD6YLIF3VjQwsAtcDdoWpDmLt
         F+I34/MnDs1eTlRY+8ELKRS23nXInUR97wwwuDq80Gzg5YFP2e3HyYk1QH3RfHUisOPX
         rkDJpeJ+itS1IcqLj+RxlS3u30Ke8OXnVOOWXVii7iQxk453vzfT/+fcquTjJSGkfyVc
         R9yX/QOS3QB4QcLD8kNDDftyw87OhvGHTlScVWv7VUGfJ4ATNDaOFdn+n29Dyr6WL/eR
         JzR0aiTsjG+WbA3L4gEENiZolFMexnVZhA6kzzFa59YhkJQK50g7A1j4NclE7DzbMjZg
         SSSQ==
ARC-Authentication-Results: i=1; mx.google.com;
       dkim=pass header.i=@griwes-info.20150623.gappssmtp.com header.b=VQx+r4/R;
       spf=neutral (google.com: 2607:f8b0:400e:c05::230 is neither permitted nor denied by best guess record for domain of admin@griwes.info) smtp.mailfrom=admin@griwes.info
Original-Received: from mail-pg0-x230.google.com (mail-pg0-x230.google.com. [2607:f8b0:400e:c05::230])
        by mx.google.com with ESMTPS id m81si11688004pfi.212.2017.07.05.00.28.16
        for <std-proposals@isocpp.org>
        (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Wed, 05 Jul 2017 00:28:16 -0700 (PDT)
Received-SPF: neutral (google.com: 2607:f8b0:400e:c05::230 is neither permitted nor denied by best guess record for domain of admin@griwes.info) client-ip=2607:f8b0:400e:c05::230;
Original-Received: by mail-pg0-x230.google.com with SMTP id k14so44424261pgr.0
        for <std-proposals@isocpp.org>; Wed, 05 Jul 2017 00:28:16 -0700 (PDT)
X-Received: by 10.84.191.165 with SMTP id a34mr20261493pld.243.1499239695897;
 Wed, 05 Jul 2017 00:28:15 -0700 (PDT)
In-Reply-To: <e2d61492-c318-46b1-89e1-94f9697875dd@isocpp.org>
X-Original-Sender: griwes@griwes.info
X-Original-Authentication-Results: mx.google.com;       dkim=pass
 header.i=@griwes-info.20150623.gappssmtp.com header.b=VQx+r4/R;
       spf=neutral (google.com: 2607:f8b0:400e:c05::230 is neither permitted
 nor denied by best guess record for domain of admin@griwes.info) smtp.mailfrom=admin@griwes.info
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:33119
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/33119>

--94eb2c18a42e81e83105538cf192
Content-Type: text/plain; charset="UTF-8"

This would:

1) Make it very easy to refer to the wrong field accidentally (of the
wrapper instead of of the wrapped object).
2) Make it so that a change in the wrapper's interface (say, adding a
field) changes the semantics of the code in a potentially silent manner -
no-one would ever again be able to add to the interface of a type exposing
the -> operator.

No.

Educate your programmers, don't hire incompetent people. It's really that
simple.

On Wed, Jul 5, 2017 at 9:24 AM Daemon Snake <swac31@gmail.com> wrote:

> Hi,
> I think a lot of us feel like the "->" operator feels quite archaic,
> so it's not uncommon to use the '.' operator while using a pointer or a
> shared or unique pointer by accident.
> The result is a compile error with an indication on where the mistake was
> made along with a "(maybe you meant to use '->' ?)" error message.
>
> For people coming from languages like Java it's a recurring error, one
> that frankly seem a bit dull and really annoying for big projects.
>
> My "solution" would be really simple to implement I believe.
> If said error is detected instead of stopping the compilation and issuing
> the error we could simply fallback on the struct dereference operator
> ("->").
> This wouldn't have any impact on legacy, or C code (or only malformed one).
> It would allow the implicit declaration of the overloading of the
> structure reference operator.
> Also make optional the "->" operator for a less cumbersome syntax at the
> end.
> The compile time impact would be minimal as it would only happen in fail
> states and the computation is not really complex.
>
> So what do you think ?
> Is there issues I haven't considered ?
>
> Thanks in advance.
> Bastien Penavayre
>
> --
> 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/e2d61492-c318-46b1-89e1-94f9697875dd%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/e2d61492-c318-46b1-89e1-94f9697875dd%40isocpp.org?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAPCFJdSzcO6_4fWYE6SjDpTKTuU1NsGdZCmMzEVJF%3DLajvgpew%40mail.gmail.com.

--94eb2c18a42e81e83105538cf192
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">This would:<div><br></div><div>1) Make it very easy to ref=
er to the wrong field accidentally (of the wrapper instead of of the wrappe=
d object).</div><div>2) Make it so that a change in the wrapper&#39;s inter=
face (say, adding a field) changes the semantics of the code in a potential=
ly silent manner - no-one would ever again be able to add to the interface =
of a type exposing the -&gt; operator.</div><div><br></div><div>No.</div><d=
iv><br></div><div>Educate your programmers, don&#39;t hire incompetent peop=
le. It&#39;s really that simple.</div></div><br><div class=3D"gmail_quote">=
<div dir=3D"ltr">On Wed, Jul 5, 2017 at 9:24 AM Daemon Snake &lt;<a href=3D=
"mailto:swac31@gmail.com">swac31@gmail.com</a>&gt; wrote:<br></div><blockqu=
ote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc s=
olid;padding-left:1ex"><div dir=3D"ltr">Hi,<div>I think a lot of us feel li=
ke the &quot;-&gt;&quot; operator feels quite archaic,<br><div>so it&#39;s =
not uncommon to use the &#39;.&#39; operator while using a pointer or a sha=
red or unique pointer by accident.</div><div>The result is a compile error =
with an indication on where the mistake was made along with a &quot;<span s=
tyle=3D"color:rgb(0,0,0);font-family:monospace;font-size:12px;white-space:p=
re-wrap">(maybe you meant to use &#39;-&gt;&#39; ?)&quot; error message.</s=
pan></div><div><span style=3D"color:rgb(0,0,0);font-family:monospace;font-s=
ize:12px;white-space:pre-wrap"><br></span></div><div><font color=3D"#000000=
" face=3D"monospace"><span style=3D"font-size:12px;white-space:pre-wrap">Fo=
r people coming from languages like Java it&#39;s a recurring error, one th=
at frankly seem a bit dull and really annoying for big projects.</span></fo=
nt></div><div><br></div><div>My &quot;solution&quot; would be really simple=
 to implement I believe.</div><div>If said error is detected instead of sto=
pping the compilation and issuing the error we could simply fallback on the=
 struct dereference operator (&quot;-&gt;&quot;).</div><div>This wouldn&#39=
;t have any impact on legacy, or C code (or only malformed one).</div><div>=
It would allow the implicit declaration of the overloading of the structure=
 reference operator.</div><div>Also make optional the &quot;-&gt;&quot; ope=
rator for a less cumbersome syntax at the end.</div><div>The compile time i=
mpact would be minimal as it would only happen in fail states and the compu=
tation is not really complex.</div><div><br></div><div>So what do you think=
 ?</div><div>Is there issues I haven&#39;t considered ?</div><div><br></div=
><div>Thanks in advance.</div></div><div>Bastien Penavayre</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" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">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/e2d61492-c318-46b1-89e1-94f9697875dd%=
40isocpp.org?utm_medium=3Demail&amp;utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/e2d61492-c318-=
46b1-89e1-94f9697875dd%40isocpp.org</a>.<br>
</blockquote></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/CAPCFJdSzcO6_4fWYE6SjDpTKTuU1NsGdZCmM=
zEVJF%3DLajvgpew%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAPCFJdSzcO6_4f=
WYE6SjDpTKTuU1NsGdZCmMzEVJF%3DLajvgpew%40mail.gmail.com</a>.<br />

--94eb2c18a42e81e83105538cf192--

.
