220 20382 <2967AF29-EF2A-4BE8-8A91-737BD7EB2C1A@gmail.com> article
Path: news.gmane.org!not-for-mail
From: David Krauss <potswa@gmail.com>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Usability improvement: Unambiguously resolve
 overloaded functions when passed as function parameters
Date: Thu, 10 Sep 2015 18:29:26 +0800
Lines: 103
Approved: news@gmane.org
Message-ID: <2967AF29-EF2A-4BE8-8A91-737BD7EB2C1A@gmail.com>
References: <a6df5848-0cdc-46eb-be42-a7e29481853f@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2104\))
Content-Type: multipart/alternative; boundary="Apple-Mail=_1F082AA6-39C1-4266-A7AD-1AECE78C8035"
X-Trace: ger.gmane.org 1441880998 24702 80.91.229.3 (10 Sep 2015 10:29:58 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Thu, 10 Sep 2015 10:29:58 +0000 (UTC)
To: std-proposals@isocpp.org
Original-X-From: std-proposals+bncBCW25A7E3QCRBDFXYWXQKGQE2UOYP3Q@isocpp.org Thu Sep 10 12:29:46 2015
Return-path: <std-proposals+bncBCW25A7E3QCRBDFXYWXQKGQE2UOYP3Q@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-ig0-f200.google.com ([209.85.213.200])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBCW25A7E3QCRBDFXYWXQKGQE2UOYP3Q@isocpp.org>)
	id 1ZZz6k-0007Hs-EB
	for gclcip-std-proposals@m.gmane.org; Thu, 10 Sep 2015 12:29:34 +0200
Original-Received: by igbbp9 with SMTP id bp9sf32482943igb.3
        for <gclcip-std-proposals@m.gmane.org>; Thu, 10 Sep 2015 03:29:33 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:from:content-type:message-id:mime-version
         :subject:date:references:to:in-reply-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=q8tvnsrGU+P+oJV+Yp5OYkjoUxkzlSOpqk1Cv+RsIEU=;
        b=TaO0E7vfnAQrvtvqnx6F8KQ3J/6qoRvp/nwwJcumy/ByWzYvZE3GvkxYhDtrZAbbEj
         C0Ynirhr3escZ8SlAAJyDuscgigbSdtIimq1b6oBW1OWl+CfnrtmnUP+RAzN9n+4IbYK
         IIS6yKn12y7G15RooQJxL2PXHkdhtYGVwOuxxctu6l2o4xaXhBGg3rCwy8kAwDHULmDv
         ZXgmMeh1j+IWDtUg0OP0XOF1HKq/sLY4VifN6C3+ucqFjRodtPAEgqtp338rTEokXfrO
         8BReVbs9PQmOGPi2GgUyBrBCZsTGHPpwqvQ599bz1whWNaMTr2y5Lfd3L/MMHFr/RJPN
         U8fA==
X-Gm-Message-State: ALoCoQk2q9/bctqx5dgVokMaVR0XGPH3crI9vA8AZI12M9DNQwp7j/7ThfcOPigh1LmWvzZoHx8n
X-Received: by 10.50.110.40 with SMTP id hx8mr2077986igb.2.1441880973468;
        Thu, 10 Sep 2015 03:29:33 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.50.178.148 with SMTP id cy20ls181311igc.32.gmail; Thu, 10 Sep
 2015 03:29:32 -0700 (PDT)
X-Received: by 10.69.12.162 with SMTP id er2mr82737048pbd.24.1441880972786;
        Thu, 10 Sep 2015 03:29:32 -0700 (PDT)
Original-Received: from mail-pa0-x231.google.com (mail-pa0-x231.google.com. [2607:f8b0:400e:c03::231])
        by mx.google.com with ESMTPS id vy5si18576708pac.2.2015.09.10.03.29.32
        for <std-proposals@isocpp.org>
        (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
        Thu, 10 Sep 2015 03:29:32 -0700 (PDT)
Received-SPF: pass (google.com: domain of potswa@gmail.com designates 2607:f8b0:400e:c03::231 as permitted sender) client-ip=2607:f8b0:400e:c03::231;
Original-Received: by padhy16 with SMTP id hy16so39675677pad.1
        for <std-proposals@isocpp.org>; Thu, 10 Sep 2015 03:29:32 -0700 (PDT)
X-Received: by 10.66.121.74 with SMTP id li10mr71764545pab.73.1441880972344;
        Thu, 10 Sep 2015 03:29:32 -0700 (PDT)
Original-Received: from [172.20.10.2] ([121.54.54.184])
        by smtp.gmail.com with ESMTPSA id rz9sm2764267pbb.61.2015.09.10.03.29.30
        for <std-proposals@isocpp.org>
        (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128);
        Thu, 10 Sep 2015 03:29:31 -0700 (PDT)
In-Reply-To: <a6df5848-0cdc-46eb-be42-a7e29481853f@isocpp.org>
X-Mailer: Apple Mail (2.2104)
X-Original-Sender: potswa@gmail.com
X-Original-Authentication-Results: mx.google.com;       spf=pass (google.com:
 domain of potswa@gmail.com designates 2607:f8b0:400e:c03::231 as permitted
 sender) smtp.mailfrom=potswa@gmail.com;       dkim=pass header.i=@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-Spam-Checked-In-Group: std-proposals@isocpp.org
X-Google-Group-Id: 399137483710
List-Post: <http://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <http://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <http://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <http://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>,
 <http://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:20382
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/20382>

--Apple-Mail=_1F082AA6-39C1-4266-A7AD-1AECE78C8035
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8


> On 2015=E2=80=9309=E2=80=9310, at 12:16 PM, Germ=C3=A1n Diago <germandiag=
o@gmail.com> wrote:
>=20
> Is there any interest in solving this problem?

Certainly. See N3617 <http://open-std.org/JTC1/SC22/WG21/docs/papers/2013/n=
3617.htm> which opened EWG 65 <http://wg21.cmeerw.net/ewg/issue65>.

The problem appears like it could be amenable to expression aliases. Howeve=
r, it=E2=80=99s tricky to fit expression aliases into either the type syste=
m or into parameter passing. Perhaps you could have an alias parameter decl=
ared with auto to imply function templating.

decltype(auto) bind5( auto [&]f ) {
    return f( 5 ); // Evaluate the argument expression here.
}

Deducing class template parameters from an initializer (i.e. parameter) cou=
ld also help to decide exactly what the wrapper is, allowing e.g. implicit =
conversion of the overloaded name to std::function when the receiver isn=E2=
=80=99t a template.

Sorry to be vague, but my personal suspicion is that the best solution lies=
 in the intersection of these several speculative solution spaces.

--=20

---=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.

--Apple-Mail=_1F082AA6-39C1-4266-A7AD-1AECE78C8035
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8

<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dutf-8"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: s=
pace; -webkit-line-break: after-white-space;" class=3D""><br class=3D""><di=
v><blockquote type=3D"cite" class=3D""><div class=3D"">On 2015=E2=80=9309=
=E2=80=9310, at 12:16 PM, Germ=C3=A1n Diago &lt;<a href=3D"mailto:germandia=
go@gmail.com" class=3D"">germandiago@gmail.com</a>&gt; wrote:</div><br clas=
s=3D"Apple-interchange-newline"><div class=3D""><span style=3D"font-family:=
 Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font=
-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto=
; text-align: start; text-indent: 0px; text-transform: none; white-space: n=
ormal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; flo=
at: none; display: inline !important;" class=3D"">Is there any interest in =
solving this problem?</span><br style=3D"font-family: Helvetica; font-size:=
 12px; font-style: normal; font-variant: normal; font-weight: normal; lette=
r-spacing: normal; line-height: normal; orphans: auto; text-align: start; t=
ext-indent: 0px; text-transform: none; white-space: normal; widows: auto; w=
ord-spacing: 0px; -webkit-text-stroke-width: 0px;" class=3D""></div></block=
quote></div><br class=3D""><div class=3D"">Certainly. See&nbsp;<a href=3D"h=
ttp://open-std.org/JTC1/SC22/WG21/docs/papers/2013/n3617.htm" class=3D"">N3=
617</a>&nbsp;which opened&nbsp;<a href=3D"http://wg21.cmeerw.net/ewg/issue6=
5" class=3D"">EWG 65</a>.</div><div class=3D""><br class=3D""></div><div cl=
ass=3D"">The problem <i class=3D"">appears</i> like it could be amenable to=
 expression aliases. However, it=E2=80=99s tricky to fit expression aliases=
 into either the type system or into parameter passing. Perhaps you could h=
ave an alias parameter declared with <font face=3D"Courier" class=3D"">auto=
</font> to imply function templating.</div><div class=3D""><br class=3D""><=
/div><div class=3D""><font face=3D"Courier" class=3D"">decltype(auto) bind5=
( auto [&amp;]f ) {</font></div><div class=3D""><font face=3D"Courier" clas=
s=3D"">&nbsp; &nbsp; return f( 5 ); // Evaluate the argument expression her=
e.</font></div><div class=3D""><font face=3D"Courier" class=3D"">}</font></=
div><div class=3D""><br class=3D""></div><div class=3D"">Deducing class tem=
plate parameters from an initializer (i.e. parameter) could also help to de=
cide exactly what the wrapper is, allowing e.g. implicit conversion of the =
overloaded name to <font face=3D"Courier" class=3D"">std::function</font>&n=
bsp;when the receiver isn=E2=80=99t a template.</div><div class=3D""><br cl=
ass=3D""></div><div class=3D"">Sorry to be vague, but my personal suspicion=
 is that the best solution lies in the intersection of these several specul=
ative solution spaces.</div><div class=3D""><br class=3D""></div></body></h=
tml>

<p></p>

-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />

--Apple-Mail=_1F082AA6-39C1-4266-A7AD-1AECE78C8035--

.
