220 27206 <361901c2-098a-47ea-ab1f-431b35389baa@isocpp.org> article
Path: news.gmane.org!not-for-mail
From: szollosi.lorand@gmail.com
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Re: Generalized "using" member aliases.
Date: Fri, 22 Jul 2016 08:56:25 -0700 (PDT)
Lines: 225
Approved: news@gmane.org
Message-ID: <361901c2-098a-47ea-ab1f-431b35389baa@isocpp.org>
References: <d0eb7c1b-19b5-4ab4-97c3-e3f1a88a7fe3@isocpp.org>
 <CACGiwhEwWaOWU9maQCXAsPMqDgeOyxMQBdVjXixfCYO_vBri9g@mail.gmail.com>
 <bcee3692-87df-4f63-b8c6-dcba5601a105@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: plane.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_904_1256354457.1469202985369"
X-Trace: ger.gmane.org 1469202993 4133 80.91.229.3 (22 Jul 2016 15:56:33 GMT)
X-Complaints-To: usenet@ger.gmane.org
NNTP-Posting-Date: Fri, 22 Jul 2016 15:56:33 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBDR7PROGSALRBKUEZG6AKGQEUUGRXSY@isocpp.org Fri Jul 22 17:56:29 2016
Return-path: <std-proposals+bncBDR7PROGSALRBKUEZG6AKGQEUUGRXSY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pa0-f72.google.com ([209.85.220.72])
	by plane.gmane.org with esmtp (Exim 4.69)
	(envelope-from <std-proposals+bncBDR7PROGSALRBKUEZG6AKGQEUUGRXSY@isocpp.org>)
	id 1bQcoO-0002T1-7V
	for gclcip-std-proposals@m.gmane.org; Fri, 22 Jul 2016 17:56:28 +0200
Original-Received: by mail-pa0-f72.google.com with SMTP id q2sf199402556pap.1
        for <gclcip-std-proposals@m.gmane.org>; Fri, 22 Jul 2016 08:56:27 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to: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=+kAB2KAWg3Mvj6zYKAJer0Sv7zABDgqNGVXZalR5+Hk=;
        b=Jz4uR28FEch/t6OGy50hRszkJDOFjsD/iOQ7S3fOMLJp6PKhs+cI71uyq9XuzHzWns
         Cob8omyN14jha9JwBPinDRMHp977zBryytB8QLWmGMZB6apf6wKPIekb4ITJNQZDX0Ma
         KmY6YY/E+D7eyLccY9O0LVbZ5/wL5OomyXyb6FmqydHiHYv7iZw38KWw1ucVs2Il9VaE
         eIMToCGjZ5TBLcBpIhqMkPxy5qdSOZ06eca7vLZyFfXCl3Ydz7dWPjrCmb2+8R7S1coe
         kYDUGtgY0OkFiIUPYO5Msnt+TXOYoQ2SDtrOBsrFCagDsEb4lKK1J5v7E4gwhX56/X85
         u8Tw==
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20120113;
        h=date:from:to: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=+kAB2KAWg3Mvj6zYKAJer0Sv7zABDgqNGVXZalR5+Hk=;
        b=ON81NDmhvzNl25TJ3ExmxbHJ8dtyYfGUfGM26f6SrTiFMdUVHnYUY0eaU7S56zlTWJ
         X+zN9XQbpc4bwyl8MqRATVPmM5UDrH2huWDxNRD5gc7MV8p0f313b4oqGyP5kcqfnPy7
         Uhp8dSqyDOWvDpWMhmJR/0R7+LyfqRbBqgmjFQHFn7teg+OHvPtFkOqSu2Y82QVYdqeJ
         q3zRiNafLvJu5Up6PyBDyxn9iFI+6hXzedx9e8pUQ2gLmoqE+iB2Ieg6rLX+B2+i13TO
         Ry4jAiXV188grSs4DL5dAHbVdC9j1cpJJTMoLlTHd+l1uLQghtBWcAwPUrf1ZlFgCJf8
         JjZQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-gm-message-state:date:from:to: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=+kAB2KAWg3Mvj6zYKAJer0Sv7zABDgqNGVXZalR5+Hk=;
        b=hX4TN6n1QywKXziUlKo9vALywzTzemj4sXjauvgzCqZR+TTpWcEgEPjUR3lSM/dEz6
         GcbmfHg9zIp0rabiopB2iBlRPzqOU9O2pzG9i1U+7GyIm3vGS5xEhAyNlKz6YLDFWrv1
         yM3H6enoKTXQQeE2+9Ho8cZWSf1+QBnmYBCMzJy74zxFLN8D8CxGupgXcMb0YAdTZ2/g
         HQbFZbfaj9ESoytJNvZmFrWIJdxX4W/VK4u2yRUKx3NhPxsH9Wd/xxuZfsjMyf/YEziA
         xI85e5FGQwRi/UXWkBsU9InNAGjTcK8Vs7gj38EHohtR8xzpZnpfSnikn1k/PKvV01Kk
         g/GQ==
X-Gm-Message-State: AEkoous50uad0TIDdz002/PHk3nxFZZ7qU2JEnw5+hsfXlrymXKZZrrOo9yMUogZRffEMQ==
X-Received: by 10.66.150.136 with SMTP id ui8mr3858213pab.1.1469202987068;
        Fri, 22 Jul 2016 08:56:27 -0700 (PDT)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.107.130.145 with SMTP id m17ls1730720ioi.32.gmail; Fri, 22 Jul
 2016 08:56:26 -0700 (PDT)
X-Received: by 10.36.111.147 with SMTP id x141mr211324itb.6.1469202986094;
        Fri, 22 Jul 2016 08:56:26 -0700 (PDT)
In-Reply-To: <bcee3692-87df-4f63-b8c6-dcba5601a105@isocpp.org>
X-Original-Sender: szollosi.lorand@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:27206
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/27206>

------=_Part_904_1256354457.1469202985369
Content-Type: multipart/alternative; 
	boundary="----=_Part_905_1995812520.1469202985369"

------=_Part_905_1995812520.1469202985369
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Hi,

As for the *pair* example, I'd suggest just using references. Note that you=
=20
can have a ref to a member of a *tuple* as well. This might or might not=20
have a memory cost depending on your compiler. As for the *using a =3D b();=
*=20
syntax, I'm not sure we want to 'hide' function calls behind members, as we=
=20
never used to do that in C++ (that's like hidden costs). That said, I'm not=
=20
completely against this, as I had this need before as well...

-lorro

2016. j=C3=BAlius 22., p=C3=A9ntek 16:58:52 UTC+2 id=C5=91pontban Derek Ros=
s a k=C3=B6vetkez=C5=91t=20
=C3=ADrta:
>
> On Friday, July 22, 2016 at 2:40:38 AM UTC-5, D. B. wrote:
>>
>> How would one disambiguate between 'aliased members' and typenames in th=
e=20
>> outer scope, which might well overlap?=20
>>
>
> It would be the same as a member variable having the same name as a type=
=20
> in the outer scope. So, already a solved problem.=20
> =20
>
>> "ExistingName could also specify a function, e.g., "ExistingName()", in=
=20
>> which case NewName becomes a property-like element."
>> - But then we have horribly ambiguous syntax for whether something is a=
=20
>> member variable or method, requiring us to constantly consult the class =
to=20
>> unearth byzantine using declarations, which don't produce "property-like=
=20
>> elements" anyway if the function signature doesn't return a modifiable=
=20
>> reference.
>>
>
> I am confident that C++ developers will be able to wrap their minds aroun=
d=20
> it.=20
> =20
>
>> "Member aliases could also be used to shorten inconveniently long names"
>> - thereby producing 2 names for the same object, cluttering the namespac=
e=20
>> and introducing ambiguity, merely to remove the responsibility of users =
not=20
>> to choose stupidly long names?
>>
>
> This is inspired by the recommended way of shortening a long namespace=20
> name, such as=20
>
> namespace American_Telephone_and_Telegraph { ... }
>
> using ATT =3D American_Telephone_and_Telegraph;
>
> or shortening typenames like:=20
>
> using vecvecstr =3D std::vector<std::vector<std::string>>;=20
> =20
>
>> "This brings tuples one step closer to being a struct replacement"
>> - sounds like ominous portent to me. structs aren't tuples, and tuples=
=20
>> aren't structs. Neither should replace the other. Do we really need to=
=20
>> introduce a bunch of problems such as the above just to make interface=
=20
>> design slightly easier for the lazy
>>
>
> If there were an easy way to convert a struct to a tuple, then some=20
> current topics such as reflection or default comparisons (see links), cou=
ld=20
> be implemented as a library rather than by changing the language.=20
>
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4475.pdf
> http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2015/n4452.pdf
> =20
> ----
> Cheers,=20
> Derek
>
>
>

--=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/361901c2-098a-47ea-ab1f-431b35389baa%40isocpp.or=
g.

------=_Part_905_1995812520.1469202985369
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi,<br><br>As for the <i>pair</i> example, I&#39;d suggest=
 just using references. Note that you can have a ref to a member of a <i>tu=
ple</i> as well. This might or might not have a memory cost depending on yo=
ur compiler. As for the <i>using a =3D b();</i> syntax, I&#39;m not sure we=
 want to &#39;hide&#39; function calls behind members, as we never used to =
do that in C++ (that&#39;s like hidden costs). That said, I&#39;m not compl=
etely against this, as I had this need before as well...<br><br>-lorro<br><=
br>2016. j=C3=BAlius 22., p=C3=A9ntek 16:58:52 UTC+2 id=C5=91pontban Derek =
Ross a k=C3=B6vetkez=C5=91t =C3=ADrta:<blockquote class=3D"gmail_quote" sty=
le=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left=
: 1ex;"><div dir=3D"ltr">On Friday, July 22, 2016 at 2:40:38 AM UTC-5, D. B=
.. wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8=
ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>How w=
ould one disambiguate between &#39;aliased members&#39; and typenames in th=
e outer scope, which might well overlap?=C2=A0<br></div></div></blockquote>=
<div><br></div><div>It would be the same as a member variable having the sa=
me name as a type in the outer scope. So, already a solved problem.=C2=A0</=
div><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0;ma=
rgin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"lt=
r"><div>&quot;ExistingName could also specify a function, e.g., &quot;Exist=
ingName()&quot;, in which case NewName becomes a property-like element.&quo=
t;<br>- But then we have horribly ambiguous syntax for whether something is=
 a member variable or method, requiring us to constantly consult the class =
to unearth byzantine using declarations, which don&#39;t produce &quot;prop=
erty-like elements&quot; anyway if the function signature doesn&#39;t retur=
n a modifiable reference.<br></div></div></blockquote><div><br></div><div>I=
 am confident that C++ developers will be able to wrap their minds around i=
t.=C2=A0</div><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"m=
argin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div=
 dir=3D"ltr"><div>&quot;Member aliases could also be used to shorten inconv=
eniently long names&quot;<br>- thereby producing 2 names for the same objec=
t, cluttering the namespace and introducing ambiguity, merely to remove the=
 responsibility of users not to choose stupidly long names?<br></div></div>=
</blockquote><div><br></div><div>This is inspired by the recommended way of=
 shortening a long namespace name, such as=C2=A0</div><div><br></div><div s=
tyle=3D"border:1px solid rgb(187,187,187);word-wrap:break-word;background-c=
olor:rgb(250,250,250)"><code><div><span style=3D"color:#008">namespace</spa=
n><span style=3D"color:#000"> </span><span style=3D"color:#606">American_Te=
lephone_and_<wbr>Telegraph</span><span style=3D"color:#000"> </span><span s=
tyle=3D"color:#660">{</span><span style=3D"color:#000"> </span><span style=
=3D"color:#660">...</span><span style=3D"color:#000"> </span><span style=3D=
"color:#660">}</span><span style=3D"color:#000"><br><br></span><span style=
=3D"color:#008">using</span><span style=3D"color:#000"> ATT </span><span st=
yle=3D"color:#660">=3D</span><span style=3D"color:#000"> </span><span style=
=3D"color:#606">American_Telephone_and_<wbr>Telegraph</span><span style=3D"=
color:#660">;</span></div></code></div><div><br></div><div>or shortening ty=
penames like:=C2=A0</div><div><br></div><div><div style=3D"border:1px solid=
 rgb(187,187,187);word-wrap:break-word;background-color:rgb(250,250,250)"><=
code><div><span style=3D"color:#008">using</span><span style=3D"color:#000"=
> vecvecstr </span><span style=3D"color:#660">=3D</span><span style=3D"colo=
r:#000"> std</span><span style=3D"color:#660">::</span><span style=3D"color=
:#000">vector</span><span style=3D"color:#660">&lt;</span><span style=3D"co=
lor:#000">std</span><span style=3D"color:#660">::</span><span style=3D"colo=
r:#000">vector</span><span style=3D"color:#660">&lt;</span><span style=3D"c=
olor:#000">std</span><span style=3D"color:#660">::</span><span style=3D"col=
or:#008">s<wbr>tring</span><span style=3D"color:#660">&gt;&gt;;</span><span=
 style=3D"color:#000"> </span></div></code></div></div><div>=C2=A0</div><bl=
ockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-l=
eft:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div>&quot;This bring=
s tuples one step closer to being a struct replacement&quot;<br></div><div>=
- sounds like ominous portent to me. structs aren&#39;t tuples, and tuples =
aren&#39;t structs. Neither should replace the other. Do we really need to =
introduce a bunch of problems such as the above just to make interface desi=
gn slightly easier for the lazy<br></div></div></blockquote><div><br></div>=
<div>If there were an easy way to convert a struct to a tuple, then some cu=
rrent topics such as reflection or default comparisons (see links), could b=
e implemented as a library rather than by changing the language.=C2=A0</div=
><div><br></div><div><a href=3D"http://www.open-std.org/jtc1/sc22/wg21/docs=
/papers/2015/n4475.pdf" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"t=
his.href=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.open-std.or=
g%2Fjtc1%2Fsc22%2Fwg21%2Fdocs%2Fpapers%2F2015%2Fn4475.pdf\x26sa\x3dD\x26snt=
z\x3d1\x26usg\x3dAFQjCNEN9hkR1Mx1bwyYCBd44bXPtlD6Aw&#39;;return true;" oncl=
ick=3D"this.href=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.ope=
n-std.org%2Fjtc1%2Fsc22%2Fwg21%2Fdocs%2Fpapers%2F2015%2Fn4475.pdf\x26sa\x3d=
D\x26sntz\x3d1\x26usg\x3dAFQjCNEN9hkR1Mx1bwyYCBd44bXPtlD6Aw&#39;;return tru=
e;">http://www.open-std.org/jtc1/<wbr>sc22/wg21/docs/papers/2015/<wbr>n4475=
..pdf</a><br></div><div><a href=3D"http://www.open-std.org/jtc1/sc22/wg21/do=
cs/papers/2015/n4452.pdf" target=3D"_blank" rel=3D"nofollow" onmousedown=3D=
"this.href=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.open-std.=
org%2Fjtc1%2Fsc22%2Fwg21%2Fdocs%2Fpapers%2F2015%2Fn4452.pdf\x26sa\x3dD\x26s=
ntz\x3d1\x26usg\x3dAFQjCNEWRKFYjHKFYueZdchjKkp0cfjhQQ&#39;;return true;" on=
click=3D"this.href=3D&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwww.o=
pen-std.org%2Fjtc1%2Fsc22%2Fwg21%2Fdocs%2Fpapers%2F2015%2Fn4452.pdf\x26sa\x=
3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEWRKFYjHKFYueZdchjKkp0cfjhQQ&#39;;return t=
rue;">http://www.open-std.org/jtc1/<wbr>sc22/wg21/docs/papers/2015/<wbr>n44=
52.pdf</a><br></div><div>=C2=A0</div><div>----</div><div>Cheers,=C2=A0</div=
><div>Derek</div><div><br></div><div><br></div></div></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/361901c2-098a-47ea-ab1f-431b35389baa%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/361901c2-098a-47ea-ab1f-431b35389baa=
%40isocpp.org</a>.<br />

------=_Part_905_1995812520.1469202985369--

------=_Part_904_1256354457.1469202985369--

.
