220 36330 <1a84e87b-c045-408c-9828-b1aba2185a0a@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: Now that the std::forward alternative has been rejected
Date: Sun, 24 Dec 2017 20:28:05 -0800 (PST)
Lines: 215
Approved: news@gmane.org
Message-ID: <1a84e87b-c045-408c-9828-b1aba2185a0a@isocpp.org>
References: <ebc148fa-9b1f-4972-8a53-6f52c6ead259@isocpp.org>
 <e447b9dd-d8d1-4b73-b1f3-4a6a5ab295a5@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_14608_921327778.1514176085868"
X-Trace: blaine.gmane.org 1514175972 12815 195.159.176.226 (25 Dec 2017 04:26:12 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Mon, 25 Dec 2017 04:26:12 +0000 (UTC)
Cc: mihailnajdenov@gmail.com
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBCEKFTV6ZUMBBV74QHJAKGQEJ47WUEA@isocpp.org Mon Dec 25 05:26:08 2017
Return-path: <std-proposals+bncBCEKFTV6ZUMBBV74QHJAKGQEJ47WUEA@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ua0-f198.google.com ([209.85.217.198])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBCEKFTV6ZUMBBV74QHJAKGQEJ47WUEA@isocpp.org>)
	id 1eTKL0-0002sh-7Z
	for gclcip-std-proposals@m.gmane.org; Mon, 25 Dec 2017 05:26:06 +0100
Original-Received: by mail-ua0-f198.google.com with SMTP id 7sf21072327uap.5
        for <gclcip-std-proposals@m.gmane.org>; Sun, 24 Dec 2017 20:28:09 -0800 (PST)
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=s7qfiJka4JzSVEp4mggbH0I+OXm8rUbpGpUH6AqXLs4=;
        b=XeWSqNKKZBaJeo9TZHxc2mmr8PpCtimlE8O85l3E3WJVQX68+R3ZRZXu1a+FYeYAZk
         46yeeFKhVu1+kfa0zKbhSc3746R//vsh4iM90SLwdU5r05wTRoLlwmnGr9Dy/WLJI6RP
         aTqYt+40E2T6+XUeSitUOj3sv99GQnulPzHzwIog9v2pTq32HPI3pXufLpXSvbnq9a07
         4PtlqNlzkANVkXqLC9+ipF2U9EaB7h0w1nPKHkFUVfh1jYOZeTJa+ruage6MXDYTcojj
         SzNQ9Yl9wGi00JMzTpblpt1fmMTYmTq2wr02gmwRi6eJW26FY/2p8tlrF8bui2+Y9kpH
         BD4A==
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=s7qfiJka4JzSVEp4mggbH0I+OXm8rUbpGpUH6AqXLs4=;
        b=ALvFdqI/OGx/traEAaRSk7THT5hM/xHrzwTHryo+QanF+68oCnD5IHwZ7Ks9xK1J52
         8ysB9XlhzyII4U/xCCsIsnViyAiCm1v44+974/rLX50dJPWnZXtOSDhbf3CcNqchjFPE
         uhr8lEd8In0mrp+R4Kdg3b05vHYtNkWUuoezABjW8QIpaOestf7ZjZLUY+TOOi36F4ys
         Pj+kAi8tuY3xLItz0mn+HiXPbzYouvYMtTf0vTWoB8topwOsWD2LGV6vuJH1k1EIkwxW
         EmxV1dhj/30KhAjEJ/ZeDnj2/HkS95trApNMduHV/RPuF4bxe910kehDqaJpEe3OG4HM
         3fKQ==
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=s7qfiJka4JzSVEp4mggbH0I+OXm8rUbpGpUH6AqXLs4=;
        b=nd8L3pS/pDWmoPqJ88ucbYNuou+LGtWy9zhUL7XPm5SK/HbT3EhIg+f2hQbX/4H7gX
         KhgKRtP7pUw6lFMWo8GEr9deE3EDduKSl4BRA6pCl0CNJjSOdhiRKTLQdMeVanae9yxN
         k78bXy5rUI4Ednp9PWEjFkesof2VoEewLz6EoQLnSXPcE/vX85vHFN2alNaQmD0eDofH
         /P8BgnYVlIv5tekw8+Y/ixmKB6j5UkazQFyPEhDV5coHM12cXNZsxJNL8XnV3m4nEReh
         IYhtRgwjnt3kfKSeAzrmIKk8RJLMVxzpBcIDeYxyHne3hbcY810H9MOIBLLKq/Ps9R1W
         b/7w==
X-Gm-Message-State: AKGB3mKwEVK5cj7+STVGBC3lGrI10pCxEMz5zioQJJ/DkmUAgE0slt0d
	Bor4Tnwo/3UxaUOXkEX6fZijzA==
X-Google-Smtp-Source: ACJfBovlaqoqK6l5zzZMXhFg6dE+gbFfQ+LiMiR72Gj4/FkVYNPNZaazNc/0oJEMe5N0gHCL1TCsWQ==
X-Received: by 10.31.84.1 with SMTP id i1mr10198435vkb.86.1514176088756;
        Sun, 24 Dec 2017 20:28:08 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.176.89.194 with SMTP id k2ls41640uad.10.gmail; Sun, 24 Dec
 2017 20:28:07 -0800 (PST)
X-Received: by 10.31.165.202 with SMTP id o193mr1961279vke.9.1514176086477;
        Sun, 24 Dec 2017 20:28:06 -0800 (PST)
In-Reply-To: <e447b9dd-d8d1-4b73-b1f3-4a6a5ab295a5@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:36330
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/36330>

------=_Part_14608_921327778.1514176085868
Content-Type: multipart/alternative; 
	boundary="----=_Part_14609_111628405.1514176085868"

------=_Part_14609_111628405.1514176085868
Content-Type: text/plain; charset="UTF-8"

On Sunday, December 24, 2017 at 8:17:30 PM UTC-5, bastie...@gmail.com wrote:
>
> On Sunday, December 24, 2017 at 9:47:30 AM UTC+1, mihailn...@gmail.com 
> wrote:
>>
>> Hello, I read 
>> <https://botondballo.wordpress.com/2017/11/20/trip-report-c-standards-meeting-in-albuquerque-november-2017/> 
>> the proposal "Forward without forward" has been rejected.
>>
>> Now, can we please reconsider fixing forward "the right way" even if it 
>> involves hacks?
>>
>> And by "the right way" a mean, of course, let the template param be 
>> omitted.
>>
>> Why is the right way? Multiple reasons:
>>
>>
>>    1. Preserve the API taught for close to 10 years now.
>>
>> actually this is false.std::forward without template param is valid and 
> your change would change its meaning.
>
>>
>>    1. Remove confusion for EVERYONE learning C++11+, be at a beginner or 
>>    advanced user.
>>    2. The param is confusing on its own (to a beginner) - should I pass 
>>    T or T&&, what happens if I pass const T, const T&&, T*? Do I really have 
>>    options here?!? Or Just One Right Param?!?!
>>
>> std::forward is fairly easy to explain to a beginner.
>

No, it's not. It's easy to tell a beginner what they have to do and when 
they have to do it. But explaining what it actually is doing (beyond 
simplistic "it's forwarding the parameters") is not easy.

But even if it wasn't the case, cases where std::forward is required are 
> not for beginners (library writing, etc...).
>

Nonsense. Writing passthrough functions should be in* everyone's* toolkit, 
not just "library writers". Thinking like that is what makes people think 
that template metaprogramming is OK, because regular C++ programmers 
shouldn't want to do things like iterate over things at compile time or 
somesuch.

Making the powers of the language more accessible is not a bad thing.


>>    1. The param is an ugly nightmare to pass in [](auto) {} scenario
>>
>> C++20 has template parameter for lambda so this is no longer a valid 
> issue.
>

Which only trades one verbosity for another.

[](auto&&... args) {return some_func(std::forward<decltype(args)>(args
)...);}

vs.

[]<template ...Args>(Args &&...args) {return some_func(std::forward<Args>(
args)...);}

This is not an improvement.

And code like this is certainly not limited to "library writers". Not 
unless C++ gets lifting lambdas/overload set lambdas (and that's sadly 
unlikely at this point). And even if we had that feature, we'd still need 
this. 

-- 
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/1a84e87b-c045-408c-9828-b1aba2185a0a%40isocpp.org.

------=_Part_14609_111628405.1514176085868
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Sunday, December 24, 2017 at 8:17:30 PM UTC-5, bastie..=
..@gmail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;marg=
in-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"=
ltr">On Sunday, December 24, 2017 at 9:47:30 AM UTC+1, <a>mihailn...@gmail.=
com</a> wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-le=
ft:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div=
>Hello, <a onmousedown=3D"this.href=3D&#39;https://www.google.com/url?q\x3d=
https%3A%2F%2Fbotondballo.wordpress.com%2F2017%2F11%2F20%2Ftrip-report-c-st=
andards-meeting-in-albuquerque-november-2017%2F\x26sa\x3dD\x26sntz\x3d1\x26=
usg\x3dAFQjCNF_vL5Ngr4VIpnzXg9U_LHKICBxaA&#39;;return true;" onclick=3D"thi=
s.href=3D&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fbotondballo.wor=
dpress.com%2F2017%2F11%2F20%2Ftrip-report-c-standards-meeting-in-albuquerqu=
e-november-2017%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF_vL5Ngr4VIpnzXg=
9U_LHKICBxaA&#39;;return true;" href=3D"https://botondballo.wordpress.com/2=
017/11/20/trip-report-c-standards-meeting-in-albuquerque-november-2017/" ta=
rget=3D"_blank" rel=3D"nofollow">I read</a> the proposal &quot;Forward with=
out forward&quot; has been rejected.</div><div><br></div><div>Now, can we p=
lease reconsider fixing forward &quot;the right way&quot; even if it involv=
es hacks?</div><div><br></div><div>And by &quot;the right way&quot; a mean,=
 of course, let the template param be omitted.</div><div><br></div><div>Why=
 is the right way? Multiple reasons:</div><div><br></div><ol><li>Preserve t=
he API taught for close to 10 years now.</li></ol></div></blockquote><div>a=
ctually this is false.std::forward without template param is valid and your=
 change would change its meaning.</div><blockquote class=3D"gmail_quote" st=
yle=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1=
ex"><div dir=3D"ltr"><ol><li>Remove confusion for EVERYONE learning C++11+,=
 be at a beginner or advanced user.</li><li>The param is confusing on its o=
wn (to a beginner) - should I pass T or T&amp;&amp;, what happens if I pass=
 const T, const T&amp;&amp;, T*? Do I really have options here?!? Or Just O=
ne Right Param?!?!</li></ol></div></blockquote><div>std::forward is fairly =
easy to explain to a beginner.</div></div></blockquote><div><br></div><div>=
No, it&#39;s not. It&#39;s easy to tell a beginner what they have to do and=
 when they have to do it. But explaining what it actually is doing (beyond =
simplistic &quot;it&#39;s forwarding the parameters&quot;) is not easy.</di=
v><div><br></div><blockquote class=3D"gmail_quote" style=3D"margin: 0;margi=
n-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"l=
tr"><div>But even if it wasn&#39;t the case, cases where std::forward is re=
quired are not for beginners (library writing, etc...).</div></div></blockq=
uote><div><br></div><div>Nonsense. Writing passthrough functions should be =
in<i> everyone&#39;s</i> toolkit, not just &quot;library writers&quot;. Thi=
nking like that is what makes people think that template metaprogramming is=
 OK, because regular C++ programmers shouldn&#39;t want to do things like i=
terate over things at compile time or somesuch.</div><div><br></div><div>Ma=
king the powers of the language more accessible is not a bad thing.</div><d=
iv><br></div><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-le=
ft: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">=
<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;borde=
r-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><ol><li>The param =
is an ugly nightmare to pass in [](auto) {} scenario</li></ol></div></block=
quote><div>C++20 has template parameter for lambda so this is no longer a v=
alid issue.</div></div></blockquote><div><br></div><div>Which only trades o=
ne verbosity for another.</div><div><br></div><div class=3D"prettyprint" st=
yle=3D"border: 1px solid rgb(187, 187, 187); word-wrap: break-word; backgro=
und-color: rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=3D"s=
ubprettyprint"><span class=3D"styled-by-prettify" style=3D"color: #660;">[]=
(</span><span class=3D"styled-by-prettify" style=3D"color: #008;">auto</spa=
n><span class=3D"styled-by-prettify" style=3D"color: #660;">&amp;&amp;...</=
span><span class=3D"styled-by-prettify" style=3D"color: #000;"> args</span>=
<span class=3D"styled-by-prettify" style=3D"color: #660;">)</span><span cla=
ss=3D"styled-by-prettify" style=3D"color: #000;"> </span><span class=3D"sty=
led-by-prettify" style=3D"color: #660;">{</span><span class=3D"styled-by-pr=
ettify" style=3D"color: #008;">return</span><span class=3D"styled-by-pretti=
fy" style=3D"color: #000;"> some_func</span><span class=3D"styled-by-pretti=
fy" style=3D"color: #660;">(</span><span class=3D"styled-by-prettify" style=
=3D"color: #000;">std</span><span class=3D"styled-by-prettify" style=3D"col=
or: #660;">::</span><span class=3D"styled-by-prettify" style=3D"color: #000=
;">forward</span><span class=3D"styled-by-prettify" style=3D"color: #660;">=
&lt;</span><span class=3D"styled-by-prettify" style=3D"color: #008;">declty=
pe</span><span class=3D"styled-by-prettify" style=3D"color: #660;">(</span>=
<span class=3D"styled-by-prettify" style=3D"color: #000;">args</span><span =
class=3D"styled-by-prettify" style=3D"color: #660;">)&gt;(</span><span clas=
s=3D"styled-by-prettify" style=3D"color: #000;">args</span><span class=3D"s=
tyled-by-prettify" style=3D"color: #660;">)...);}</span></div></code></div>=
<div><br></div><div>vs.</div><div><br></div><div class=3D"prettyprint" styl=
e=3D"border: 1px solid rgb(187, 187, 187); word-wrap: break-word; backgroun=
d-color: rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=3D"sub=
prettyprint"><span class=3D"styled-by-prettify" style=3D"color: #660;">[]&l=
t;</span><span class=3D"styled-by-prettify" style=3D"color: #008;">template=
</span><span class=3D"styled-by-prettify" style=3D"color: #000;"> </span><s=
pan class=3D"styled-by-prettify" style=3D"color: #660;">...</span><span cla=
ss=3D"styled-by-prettify" style=3D"color: #606;">Args</span><span class=3D"=
styled-by-prettify" style=3D"color: #660;">&gt;(</span><span class=3D"style=
d-by-prettify" style=3D"color: #606;">Args</span><span class=3D"styled-by-p=
rettify" style=3D"color: #000;"> </span><span class=3D"styled-by-prettify" =
style=3D"color: #660;">&amp;&amp;...</span><span class=3D"styled-by-prettif=
y" style=3D"color: #000;">args</span><span class=3D"styled-by-prettify" sty=
le=3D"color: #660;">)</span><span class=3D"styled-by-prettify" style=3D"col=
or: #000;"> </span><span class=3D"styled-by-prettify" style=3D"color: #660;=
">{</span><span class=3D"styled-by-prettify" style=3D"color: #008;">return<=
/span><span class=3D"styled-by-prettify" style=3D"color: #000;"> some_func<=
/span><span class=3D"styled-by-prettify" style=3D"color: #660;">(</span><sp=
an class=3D"styled-by-prettify" style=3D"color: #000;">std</span><span clas=
s=3D"styled-by-prettify" style=3D"color: #660;">::</span><span class=3D"sty=
led-by-prettify" style=3D"color: #000;">forward</span><span class=3D"styled=
-by-prettify" style=3D"color: #660;">&lt;</span><span class=3D"styled-by-pr=
ettify" style=3D"color: #606;">Args</span><span class=3D"styled-by-prettify=
" style=3D"color: #660;">&gt;(</span><span class=3D"styled-by-prettify" sty=
le=3D"color: #000;">args</span><span class=3D"styled-by-prettify" style=3D"=
color: #660;">)...);}</span><span class=3D"styled-by-prettify" style=3D"col=
or: #000;"><br></span></div></code></div><div><br></div><div>This is not an=
 improvement.</div><div><br></div><div>And code like this is certainly not =
limited to &quot;library writers&quot;. Not unless C++ gets lifting lambdas=
/overload set lambdas (and that&#39;s sadly unlikely at this point). And ev=
en if we had that feature, we&#39;d still need this.=C2=A0<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/1a84e87b-c045-408c-9828-b1aba2185a0a%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/1a84e87b-c045-408c-9828-b1aba2185a0a=
%40isocpp.org</a>.<br />

------=_Part_14609_111628405.1514176085868--

------=_Part_14608_921327778.1514176085868--

.
