Topic: Daft: Unified Call Syntax via user-side opt-in
Author: mihailnajdenov@gmail.com
Date: Mon, 13 Aug 2018 23:03:09 -0700 (PDT)
Raw View
------=_Part_1834_1114808901.1534226589454
Content-Type: multipart/alternative;
boundary="----=_Part_1835_1319626906.1534226589454"
------=_Part_1835_1319626906.1534226589454
Content-Type: text/plain; charset="UTF-8"
Hello, I have written a proposal for Unified Call Syntax, based on the
previous discussion.
https://1drv.ms/u/s!AifghXUnpCc8hAaU7HpR2avsms3b
Feedback is welcome.
PS. This is the fifth attempt to post, hence the link instead of an
attachment.
--
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/bbef13e4-2d0e-4433-b80a-9f2070d349de%40isocpp.org.
------=_Part_1835_1319626906.1534226589454
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>Hello, I have written a proposal for Unified Call Syn=
tax, based on the previous discussion.</div><div><br></div><div>https://1dr=
v.ms/u/s!AifghXUnpCc8hAaU7HpR2avsms3b</div><div><br></div><div><br style=3D=
"background-attachment: scroll; background-clip: border-box; background-col=
or: transparent; background-image: none; background-origin: padding-box; ba=
ckground-position-x: 0%; background-position-y: 0%; background-repeat: repe=
at; background-size: auto; border-bottom-color: rgb(34, 34, 34); border-bot=
tom-style: none; border-bottom-width: 0px; border-image-outset: 0; border-i=
mage-repeat: stretch; border-image-slice: 100%; border-image-source: none; =
border-image-width: 1; border-left-color: rgb(34, 34, 34); border-left-styl=
e: none; border-left-width: 0px; border-right-color: rgb(34, 34, 34); borde=
r-right-style: none; border-right-width: 0px; border-top-color: rgb(34, 34,=
34); border-top-style: none; border-top-width: 0px; color: rgb(34, 34, 34)=
; font-family: &quot;Arial&quot;,&quot;Helvetica&quot;,sans=
-serif; font-size: 13px; height: auto; margin-bottom: 0px; margin-left: 0px=
; margin-right: 0px; margin-top: 0px; min-width: 0px; overflow: visible; ov=
erflow-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: =
0px; padding-right: 0px; padding-top: 0px;"></div><div><div style=3D"backgr=
ound-color: transparent; border-bottom-color: rgb(34, 34, 34); border-botto=
m-style: none; border-bottom-width: 0px; border-image-outset: 0; border-ima=
ge-repeat: stretch; border-image-slice: 100%; border-image-source: none; bo=
rder-image-width: 1; border-left-color: rgb(34, 34, 34); border-left-style:=
none; border-left-width: 0px; border-right-color: rgb(34, 34, 34); border-=
right-style: none; border-right-width: 0px; border-top-color: rgb(34, 34, 3=
4); border-top-style: none; border-top-width: 0px; color: rgb(34, 34, 34); =
font-family: &quot;Arial&quot;,&quot;Helvetica&quot;,sans-s=
erif; font-size: 13px; font-style: normal; font-variant: normal; font-weigh=
t: 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margi=
n-right: 0px; margin-top: 0px; orphans: 2; padding-bottom: 0px; padding-lef=
t: 0px; padding-right: 0px; padding-top: 0px; text-align: left; text-decora=
tion: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-wid=
th: 0px; white-space: normal; word-spacing: 0px;">Feedback is welcome.</div=
><b></b><i></i><u></u><sub></sub><sup></sup><strike></strike><br></div><div=
><b></b><i></i><u></u><sub></sub><sup></sup><strike></strike><br></div><div=
>PS. This is the fifth attempt to post, hence the link instead of an attach=
ment.=C2=A0</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/bbef13e4-2d0e-4433-b80a-9f2070d349de%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/bbef13e4-2d0e-4433-b80a-9f2070d349de=
%40isocpp.org</a>.<br />
------=_Part_1835_1319626906.1534226589454--
------=_Part_1834_1114808901.1534226589454--
.
Author: yakitori1010@gmail.com
Date: Fri, 17 Aug 2018 12:31:27 -0700 (PDT)
Raw View
------=_Part_942_923318648.1534534287314
Content-Type: multipart/alternative;
boundary="----=_Part_943_1117489371.1534534287314"
------=_Part_943_1117489371.1534534287314
Content-Type: text/plain; charset="UTF-8"
hello.
i am read thread master proposal.
i am not native,maybe getting incomplete.
i think.
i want to change compile time mechanics.so change to 2pass.
because one for UCS.and other for implementation.
1pass cant solve cross reference.and cant use same source's under code.
to 2pass is good effect for UCS.
yes.it makes some load.
many load can reduce by recently feature.
if it cant be done the type issue.
elder talk about compile time lookup?
so maybe solve by 2pass.
it is not force.it is be max.
i think so.
---
i am add file.this file not be for discussion's mainline.
if you are interested.try playing.
--
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/0f66b714-d935-451e-90e7-4b094d55a655%40isocpp.org.
------=_Part_943_1117489371.1534534287314
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>hello.</div><div>i am read thread master proposal.</d=
iv><div>i am not native,maybe getting incomplete.</div><div><br></div><div>=
i think.</div><div>i want to change compile time mechanics.so change to 2pa=
ss.</div><div>because one for UCS.and other for implementation.</div><div>1=
pass cant solve cross reference.and cant use same source's under code.<=
/div><div><br></div><div>to 2pass is good effect for UCS.</div><div>yes.it =
makes some load.</div><div>many load can reduce by recently feature.</div><=
div>if it cant be done the type issue.</div><div><br></div><div>elder talk =
about compile time lookup?</div><div>so maybe solve by 2pass.</div><div>it =
is not force.it is be max.</div><div>i think so.<br></div><div>---</div><di=
v>i am add file.this file not be for discussion's mainline.</div><div>i=
f you are interested.try playing.</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/0f66b714-d935-451e-90e7-4b094d55a655%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/0f66b714-d935-451e-90e7-4b094d55a655=
%40isocpp.org</a>.<br />
------=_Part_943_1117489371.1534534287314--
------=_Part_942_923318648.1534534287314
Content-Type: text/x-c++src; charset=UTF-16LE;
name="cant solve by simply.cpp"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="cant solve by simply.cpp"
X-Attachment-Id: 50d056cd-2d1d-48fc-8373-8ae6598f3667
Content-ID: <50d056cd-2d1d-48fc-8373-8ae6598f3667>
//4jAGkAbgBjAGwAdQBkAGUAIAA8AGkAbwBzAHQAcgBlAGEAbQA+AA0ACgANAAoAIwBpAGYAIAAw
AA0ACgANAAoAYwBsAGEAcwBzACAAQQA7AA0ACgBjAGwAYQBzAHMAIABCADsADQAKAA0ACgBjAGwA
YQBzAHMAIABBACAAewANAAoAcAB1AGIAbABpAGMAOgANAAoACQBBACgAKQB7AH0ADQAKAAkAQQAo
AGMAbwBuAHMAdAAgAEIAJgAgAEkAbgApACAAOgBiACgASQBuACkAIAB7AH0ADQAKAA0ACgAJAGIA
bwBvAGwAIABTAGgAbwB3ACgAKQAgAHsAIABzAHQAZAA6ADoAYwBvAHUAdAAgADwAPAAgACIAQwBh
AGwAbAAgAEIAeQAgAEEAIQAiACAAPAA8ACAAcwB0AGQAOgA6AGUAbgBkAGwAOwAgAHIAZQB0AHUA
cgBuACAAdAByAHUAZQA7ACAAfQANAAoACQBiAG8AbwBsACAAQwBhAGwAbABPAHQAaABlAHIAKAAp
ACAAewAgAGIALgBTAGgAbwB3ACgAKQA7ACAAcgBlAHQAdQByAG4AIAB0AHIAdQBlADsAIAB9AA0A
CgANAAoAcAByAG8AdABlAGMAdABlAGQAOgANAAoACQBCACAAYgA7AA0ACgB9ADsADQAKAGMAbABh
AHMAcwAgAEIAIAB7AA0ACgBwAHUAYgBsAGkAYwA6AA0ACgAJAEIAKAApACAAewB9AA0ACgAJAGIA
bwBvAGwAIABTAGgAbwB3ACgAKQAgAHsAIABzAHQAZAA6ADoAYwBvAHUAdAAgADwAPAAgACIAQwBh
AGwAbAAgAEIAeQAgAEIAIQAiACAAPAA8ACAAcwB0AGQAOgA6AGUAbgBkAGwAOwAgAHIAZQB0AHUA
cgBuACAAdAByAHUAZQA7ACAAfQANAAoACQBBACAARwBlAHQAKAApACAAewAgAHIAZQB0AHUAcgBu
ACAAQQAoACoAdABoAGkAcwApADsAIAB9AA0ACgB9ADsADQAKAA0ACgAjAGUAbABzAGUADQAKAGMA
bABhAHMAcwAgAEIAOwANAAoADQAKAHQAZQBtAHAAbABhAHQAZQA8AGMAbABhAHMAcwAgAFQAPgAg
AGMAbABhAHMAcwAgAEEAVAA7AC8ALwB3AGgAeQAgAG4AZQBlAGQAIAB0AGgAaQBzACAAaABhAGMA
awA/AA0ACgB0AHkAcABlAGQAZQBmACAAQQBUADwAQgA+ACAAQQA7AA0ACgANAAoAdABlAG0AcABs
AGEAdABlADwAYwBsAGEAcwBzACAAVAA+AA0ACgBjAGwAYQBzAHMAIABBAFQAIAB7AA0ACgBwAHUA
YgBsAGkAYwA6AA0ACgAJAEEAVAAoACkAewB9AA0ACgAJAEEAVAAoAGMAbwBuAHMAdAAgAFQAJgAg
AEkAbgApACAAOgBiACgASQBuACkAIAB7AH0ADQAKAA0ACgAJAGIAbwBvAGwAIABTAGgAbwB3ACgA
KQAgAHsAIABzAHQAZAA6ADoAYwBvAHUAdAAgADwAPAAgACIAQwBhAGwAbAAgAEIAeQAgAEEAIQAi
ACAAPAA8ACAAcwB0AGQAOgA6AGUAbgBkAGwAOwAgAHIAZQB0AHUAcgBuACAAdAByAHUAZQA7ACAA
fQANAAoACQBiAG8AbwBsACAAQwBhAGwAbABPAHQAaABlAHIAKAApACAAewAgAGIALgBTAGgAbwB3
ACgAKQA7ACAAcgBlAHQAdQByAG4AIAB0AHIAdQBlADsAIAB9AA0ACgANAAoAcAByAG8AdABlAGMA
dABlAGQAOgANAAoACQBUACAAYgA7AA0ACgB9ADsADQAKAGMAbABhAHMAcwAgAEIAIAB7AA0ACgBw
AHUAYgBsAGkAYwA6AA0ACgAJAEIAKAApACAAewB9AA0ACgAJAGIAbwBvAGwAIABTAGgAbwB3ACgA
KQAgAHsAIABzAHQAZAA6ADoAYwBvAHUAdAAgADwAPAAgACIAQwBhAGwAbAAgAEIAeQAgAEIAIQAi
ACAAPAA8ACAAcwB0AGQAOgA6AGUAbgBkAGwAOwAgAHIAZQB0AHUAcgBuACAAdAByAHUAZQA7ACAA
fQANAAoACQBBACAARwBlAHQAKAApACAAewAgAHIAZQB0AHUAcgBuACAAQQAoACoAdABoAGkAcwAp
ADsAIAB9AA0ACgB9ADsADQAKAA0ACgAjAGUAbgBkAGkAZgANAAoADQAKAGkAbgB0ACAAbQBhAGkA
bgAoACkADQAKAHsADQAKAA0ACgAJAEIAIABiADsADQAKAAkAQQAgAGEAOwANAAoACQBhAC4AQwBh
AGwAbABPAHQAaABlAHIAKAApADsADQAKAH0ADQAKAA==
------=_Part_942_923318648.1534534287314--
.
Author: mihailnajdenov@gmail.com
Date: Sat, 18 Aug 2018 06:31:32 -0700 (PDT)
Raw View
------=_Part_1096_1515126470.1534599092990
Content-Type: multipart/alternative;
boundary="----=_Part_1097_785779684.1534599092991"
------=_Part_1097_785779684.1534599092991
Content-Type: text/plain; charset="UTF-8"
On Friday, August 17, 2018 at 10:31:27 PM UTC+3, yakito...@gmail.com wrote:
>
> hello.
> i am read thread master proposal.
> i am not native,maybe getting incomplete.
>
> i think.
> i want to change compile time mechanics.so change to 2pass.
> because one for UCS.and other for implementation.
> 1pass cant solve cross reference.and cant use same source's under code.
>
> to 2pass is good effect for UCS.
> yes.it makes some load.
> many load can reduce by recently feature.
> if it cant be done the type issue.
>
> elder talk about compile time lookup?
> so maybe solve by 2pass.
> it is not force.it is be max.
> i think so.
> ---
> i am add file.this file not be for discussion's mainline.
> if you are interested.try playing.
>
Note that this is not UCS as you combine two objects. This is more similar
to "overloading the dot operator" idea (especially the non-Bjarne
alternative) as you make one object to pretend to be another.
--
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/1c51a10e-5831-474b-88b9-588466eb09ab%40isocpp.org.
------=_Part_1097_785779684.1534599092991
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Friday, August 17, 2018 at 10:31:27 PM UTC+3, y=
akito...@gmail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin:=
0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div =
dir=3D"ltr"><div>hello.</div><div>i am read thread master proposal.</div><d=
iv>i am not native,maybe getting incomplete.</div><div><br></div><div>i thi=
nk.</div><div>i want to change compile time mechanics.so change to 2pass.</=
div><div>because one for UCS.and other for implementation.</div><div>1pass =
cant solve cross reference.and cant use same source's under code.</div>=
<div><br></div><div>to 2pass is good effect for UCS.</div><div><a onmousedo=
wn=3D"this.href=3D'http://www.google.com/url?q\x3dhttp%3A%2F%2Fyes.it\x=
26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF0Xd8QQ90ZRcncIM0vVP4vjrzgag';re=
turn true;" onclick=3D"this.href=3D'http://www.google.com/url?q\x3dhttp=
%3A%2F%2Fyes.it\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF0Xd8QQ90ZRcncIM0vV=
P4vjrzgag';return true;" href=3D"http://yes.it" target=3D"_blank" rel=
=3D"nofollow">yes.it</a> makes some load.</div><div>many load can reduce by=
recently feature.</div><div>if it cant be done the type issue.</div><div><=
br></div><div>elder talk about compile time lookup?</div><div>so maybe solv=
e by 2pass.</div><div>it is not <a onmousedown=3D"this.href=3D'http://w=
ww.google.com/url?q\x3dhttp%3A%2F%2Fforce.it\x26sa\x3dD\x26sntz\x3d1\x26usg=
\x3dAFQjCNFh8xfsXR_2UOAX8iUrCr9lSByXfQ';return true;" onclick=3D"this.h=
ref=3D'http://www.google.com/url?q\x3dhttp%3A%2F%2Fforce.it\x26sa\x3dD\=
x26sntz\x3d1\x26usg\x3dAFQjCNFh8xfsXR_2UOAX8iUrCr9lSByXfQ';return true;=
" href=3D"http://force.it" target=3D"_blank" rel=3D"nofollow">force.it</a> =
is be max.</div><div>i think so.<br></div><div>---</div><div>i am add file.=
this file not be for discussion's mainline.</div><div>if you are intere=
sted.try playing.</div></div></blockquote><div><br></div><div>Note that thi=
s is not UCS as you combine two objects. This is more similar to "over=
loading the dot operator" idea (especially the non-Bjarne alternative)=
as you make one object to pretend to be another.</div><div><br></div><div>=
<br></div><div>=C2=A0</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/1c51a10e-5831-474b-88b9-588466eb09ab%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/1c51a10e-5831-474b-88b9-588466eb09ab=
%40isocpp.org</a>.<br />
------=_Part_1097_785779684.1534599092991--
------=_Part_1096_1515126470.1534599092990--
.
Author: Barry Revzin <barry.revzin@gmail.com>
Date: Sat, 18 Aug 2018 18:14:06 -0700 (PDT)
Raw View
------=_Part_19_151228702.1534641247090
Content-Type: multipart/alternative;
boundary="----=_Part_20_1976165061.1534641247090"
------=_Part_20_1976165061.1534641247090
Content-Type: text/plain; charset="UTF-8"
On Tuesday, August 14, 2018 at 1:03:09 AM UTC-5, mihailn...@gmail.com wrote:
>
> Hello, I have written a proposal for Unified Call Syntax, based on the
> previous discussion.
>
> https://1drv.ms/u/s!AifghXUnpCc8hAaU7HpR2avsms3b
>
>
It seems like this paper is very focused on attempting to solve the
problems with the previous UFCS proposals, rather than trying to solve the
problems that UFCS was trying to solve. As a result, it doesn't actually
solve the original problems. Here is part of the motivation for N4474:
Having two call syntaxes makes it hard to write generic code: which syntax
> can we assume from a template argument type? When we start writing
> concepts, we will either have to support both syntaxes (verbose,
> potentially doubling the size of concepts) or make assumptions about how
> objects of certain binds of types are to be invoked (and we may be wrong
> close to 50% of the time). Today, we already have the problem that many
> standard-library types are supported by two functions, such as, begin(x)
> and x.begin(), and swap(x,y) and x.swap(y). This is an increasing problem
>
and from N4165:
It is a well-known and long-standing problem that C++ has two incompatible
> calling syntaxes:[...] Unfortunately, this means that calling code must
> know whether a function is a member function or not. In particular, this
> syntactic difference defeats writing generic code which must select a
> single syntax and therefore has no reasonable and direct way to invoke a
> function f on an object x without first knowing whether f is a member
> function or not for that type. Because there is no single syntax that can
> invoke both, it is difficult or impossible to write generic code that can
> adapt
>
and from N4174:
This note explores the possibility of providing a uniform call syntax by
> giving member functions preference over non-member functions. Offering the
> choice between the x.f(y) and f(x,y) notations with different meanings
> means that different people will chose differently for their function
> definitions, so that users have to know the choice and write calls
> appropriately. This gives users more opportunities for making mistakes,
> makes it harder to write generic code, and has led to replication when
> people define both a member and a non-member function to express the same
> thing. I suggest that providing different meanings to the two syntaxes
> offers no significant advantage
>
Now, I don't think generic code is the *only* motivation for having this
kind of feature - but it was a big motivation for the original papers.
Basically, being able to, in generic code, write either x.f(y) or f(x, y)
and have that work regardless if X provides a member f or a non-member f.
With your proposal - I still can't do this. In order for f(x, y) to find
x.f(y), I would have to already know the X::f exists and bring it in with a
using-declaration. But, if I already know it exists, why wouldn't I just
write x.f(y) to begin with? I can't write:
template <typename T>
void algo(T t) {
using T::f; // what if there is no T::f?
f(t, Y{});
}
We would have to add something about being able to write dependent
using-declarations and having them just do nothing instead of failing
(which is, I think, questionable), but then every function template would
just be littered with all of these using-declarations for every possible
unqualified call? That seems fairly hostile to library writers.
And then, in order for x.f(y) to find f(x, y), I need to redeclare the
type? This definitely won't work in generic code. Where would I do it? What
if it's a nested type or a template specialization or ... ?
Additionally, I'm not sure this opt-in syntax meaningfully addresses the
concern that I have seen from library authors about allowing x.f(y) to find
f(x, y) - which is that now if class X adds anything named "f" at all, even
if it's a private member that users aren't intended to be aware of, it
breaks user code. This:
Declared this way, if lib::Image ever gets a 'save' method, we will get a
> redefinition error, instead of silent change of implementation.
>
Doesn't really address their concern. User code is *still broken *by a
seemingly irrelevant change. Sure, the error might be better - you could
clearly say that "X::f is a member function but you're trying to say it
doesn't exist" instead of "error: trying to access private member int"
which would be incredibly confusing. And if an X::f was added that was
public and completely compatible with ::f, you would get an error instead
of silently potentially-different code, which is good. But the point
remains that user code is still broken.
So I'm not sure this is the right direction.
Barry
--
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/e1e54ed9-0186-42ce-a48e-d739e481047d%40isocpp.org.
------=_Part_20_1976165061.1534641247090
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Tuesday, August 14, 2018 at 1:03:09 AM UTC-5, m=
ihailn...@gmail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin=
: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div=
dir=3D"ltr"><div>Hello, I have written a proposal for Unified Call Syntax,=
based on the previous discussion.</div><div><br></div><div><a href=3D"http=
s://1drv.ms/u/s!AifghXUnpCc8hAaU7HpR2avsms3b" target=3D"_blank" rel=3D"nofo=
llow" onmousedown=3D"this.href=3D'https://www.google.com/url?q\x3dhttps=
%3A%2F%2F1drv.ms%2Fu%2Fs!AifghXUnpCc8hAaU7HpR2avsms3b\x26sa\x3dD\x26sntz\x3=
d1\x26usg\x3dAFQjCNG04c6K3LMlvdVwqzi6-rDDAAGV3Q';return true;" onclick=
=3D"this.href=3D'https://www.google.com/url?q\x3dhttps%3A%2F%2F1drv.ms%=
2Fu%2Fs!AifghXUnpCc8hAaU7HpR2avsms3b\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQj=
CNG04c6K3LMlvdVwqzi6-rDDAAGV3Q';return true;">https://1drv.ms/u/s!<wbr>=
AifghXUnpCc8hAaU7HpR2avsms3b</a></div><div><br></div></div></blockquote><di=
v><br></div><div>It seems like this paper is very focused on attempting to =
solve the problems with the previous UFCS proposals, rather than trying to =
solve the problems that UFCS was trying to solve. As a result, it doesn'=
;t actually solve the original problems. Here is part of the motivation for=
N4474:</div><div><br></div><blockquote class=3D"gmail_quote" style=3D"marg=
in: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-l=
eft: 1ex;">Having two call syntaxes makes it hard to write generic code: wh=
ich syntax can we assume from a
template argument type? When we start writing concepts, we will either have=
to support both syntaxes
(verbose, potentially doubling the size of concepts) or make assumptions ab=
out how objects of certain
binds of types are to be invoked (and we may be wrong close to 50% of the t=
ime).
Today, we already have the problem that many standard-library types are sup=
ported by two functions,
such as, begin(x) and x.begin(), and swap(x,y) and x.swap(y). This is an in=
creasing problem<br></blockquote><div><br></div><div>and from N4165:</div><=
div><br></div><blockquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0p=
x 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">It =
is a well-known and long-standing problem that C++ has two incompatible cal=
ling syntaxes:[...]=C2=A0Unfortunately, this means that calling code must k=
now whether a function is a member function or not.
In particular, this syntactic difference defeats writing generic code which=
must select a single syntax and
therefore has no reasonable and direct way to invoke a function f on an obj=
ect x without first knowing=20
whether f is a member function or not for that type. Because there is no si=
ngle syntax that can invoke
both, it is difficult or impossible to write generic code that can adapt<br=
></blockquote><div><br></div><div>and from N4174:</div><div><br></div><bloc=
kquote class=3D"gmail_quote" style=3D"margin: 0px 0px 0px 0.8ex; border-lef=
t: 1px solid rgb(204, 204, 204); padding-left: 1ex;">This note explores the=
possibility of providing a uniform call syntax by giving member functions
preference over non-member functions. Offering the choice between the x.f(y=
) and f(x,y) notations with
different meanings means that different people will chose differently for t=
heir function definitions, so
that users have to know the choice and write calls appropriately. This give=
s users more opportunities for
making mistakes, makes it harder to write generic code, and has led to repl=
ication when people define
both a member and a non-member function to express the same thing. I sugges=
t that providing different
meanings to the two syntaxes offers no significant advantage<br></blockquot=
e><div><br></div><div>Now, I don't think generic code is the <i>only</i=
>=C2=A0motivation for having this kind of feature - but it was a big motiva=
tion for the original papers. Basically, being able to, in generic code, wr=
ite either x.f(y) or f(x, y) and have that work regardless if X provides a =
member f or a non-member f.=C2=A0</div><div><br></div><div>With your propos=
al - I still can't do this. In order for f(x, y) to find x.f(y), I woul=
d have to already know the X::f exists and bring it in with a using-declara=
tion. But, if I already know it exists, why wouldn't I just write x.f(y=
) to begin with? I can't write:</div><div><br></div><div><div class=3D"=
prettyprint" style=3D"background-color: rgb(250, 250, 250); border-color: r=
gb(187, 187, 187); border-style: solid; border-width: 1px; word-wrap: break=
-word;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span sty=
le=3D"color: #008;" class=3D"styled-by-prettify">template</span><font color=
=3D"#666600"><span style=3D"color: #000;" class=3D"styled-by-prettify"> </s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">typename</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> T</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">></span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #=
008;" class=3D"styled-by-prettify">void</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> algo</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify">T t</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 <=
/span><span style=3D"color: #008;" class=3D"styled-by-prettify">using</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> T</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify">f</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> </span><span style=3D"color: #800;" class=3D"styl=
ed-by-prettify">// what if there is no T::f?</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 f</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify">t</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> Y</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">{});</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"><br></span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</s=
pan></font></div></code></div><br>We would have to add something about bein=
g able to write dependent using-declarations and having them just do nothin=
g instead of failing (which is, I think, questionable), but then every func=
tion template would just be littered with all of these using-declarations f=
or every possible unqualified call? That seems fairly hostile to library wr=
iters.</div><div><br></div><div>And then, in order for x.f(y) to find f(x, =
y), I need to redeclare the type? This definitely won't work in generic=
code. Where would I do it? What if it's a nested type or a template sp=
ecialization or ... ?<br></div><div><br></div><div>Additionally, I'm no=
t sure this opt-in syntax meaningfully addresses the concern that I have se=
en from library authors about allowing x.f(y) to find f(x, y) - which is th=
at now if class X adds anything named "f" at all, even if it'=
s a private member that users aren't intended to be aware of, it breaks=
user code. This:</div><div><br></div><blockquote class=3D"gmail_quote" sty=
le=3D"margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204);=
padding-left: 1ex;"><p style=3D"color: rgb(51, 51, 51); font-family: Helve=
tica, arial, freesans, clean, sans-serif; font-size: 14px;">Declared this w=
ay, if=C2=A0<code style=3D"border-width: 1px; border-style: solid; border-c=
olor: rgb(234, 234, 234); font-size: 12px; font-family: Consolas, "Lib=
eration Mono", Courier, monospace; white-space: nowrap; background-col=
or: rgb(248, 248, 248); border-radius: 3px;">lib::Image</code>=C2=A0ever ge=
ts a 'save' method, we will get a redefinition error, instead of si=
lent change of implementation.</p></blockquote><div><br></div><div>Doesn=
9;t really address their concern. User code is <b>still broken </b>by a see=
mingly irrelevant change. Sure, the error might be better - you could clear=
ly say that "X::f is a member function but you're trying to say it=
doesn't exist" instead of "error: trying to access private m=
ember int" which would be incredibly confusing. And if an X::f was add=
ed that was public and completely compatible with ::f, you would get an err=
or instead of silently potentially-different code, which is good. But the p=
oint remains that user code is still broken.=C2=A0</div><div><br></div><div=
>So I'm not sure this is the right direction.</div><div><br></div><div>=
Barry</div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/e1e54ed9-0186-42ce-a48e-d739e481047d%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/e1e54ed9-0186-42ce-a48e-d739e481047d=
%40isocpp.org</a>.<br />
------=_Part_20_1976165061.1534641247090--
------=_Part_19_151228702.1534641247090--
.
Author: NicTheNZer <nicolas.croad@gmail.com>
Date: Sat, 18 Aug 2018 18:33:00 -0700 (PDT)
Raw View
------=_Part_1204_101695319.1534642380264
Content-Type: multipart/alternative;
boundary="----=_Part_1205_649580278.1534642380264"
------=_Part_1205_649580278.1534642380264
Content-Type: text/plain; charset="UTF-8"
>
>
> With your proposal - I still can't do this. In order for f(x, y) to find
> x.f(y), I would have to already know the X::f exists and bring it in with a
> using-declaration. But, if I already know it exists, why wouldn't I just
> write x.f(y) to begin with? I can't write:
>
> template <typename T>
> void algo(T t) {
> using T::f; // what if there is no T::f?
> f(t, Y{});
> }
>
> We would have to add something about being able to write dependent
> using-declarations and having them just do nothing instead of failing
> (which is, I think, questionable), but then every function template would
> just be littered with all of these using-declarations for every possible
> unqualified call? That seems fairly hostile to library writers.
>
I had a thought recently on the behaviour of using T::f; when there is no
such method. If using T::f is simply ignored where there are no matching
members then it makes it much easier to remove functions from a type and
just keep the ones you want (as available). So I thought if T is a
dependent context (same as when forwarding references apply) without such
members then using T::f should generate no errors but just do nothing.
There are other issues around universal call syntax, private members and
the like though as you mentioned.
--
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/862b5312-4661-4fc0-b4b3-2b78d2fddcc5%40isocpp.org.
------=_Part_1205_649580278.1534642380264
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;bor=
der-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div><br></di=
v><div>With your proposal - I still can't do this. In order for f(x, y)=
to find x.f(y), I would have to already know the X::f exists and bring it =
in with a using-declaration. But, if I already know it exists, why wouldn&#=
39;t I just write x.f(y) to begin with? I can't write:</div><div><br></=
div><div><div style=3D"background-color:rgb(250,250,250);border-color:rgb(1=
87,187,187);border-style:solid;border-width:1px;word-wrap:break-word"><code=
><div><span style=3D"color:#008">template</span><font color=3D"#666600"><sp=
an style=3D"color:#000"> </span><span style=3D"color:#660"><</span><span=
style=3D"color:#008">typename</span><span style=3D"color:#000"> T</span><s=
pan style=3D"color:#660">></span><span style=3D"color:#000"><br></span><=
span style=3D"color:#008">void</span><span style=3D"color:#000"> algo</span=
><span style=3D"color:#660">(</span><span style=3D"color:#000">T t</span><s=
pan style=3D"color:#660">)</span><span style=3D"color:#000"> </span><span s=
tyle=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </=
span><span style=3D"color:#008">using</span><span style=3D"color:#000"> T</=
span><span style=3D"color:#660">::</span><span style=3D"color:#000">f</span=
><span style=3D"color:#660">;</span><span style=3D"color:#000"> </span><spa=
n style=3D"color:#800">// what if there is no T::f?</span><span style=3D"co=
lor:#000"><br>=C2=A0 =C2=A0 f</span><span style=3D"color:#660">(</span><spa=
n style=3D"color:#000">t</span><span style=3D"color:#660">,</span><span sty=
le=3D"color:#000"> Y</span><span style=3D"color:#660">{});</span><span styl=
e=3D"color:#000"><br></span><span style=3D"color:#660">}</span></font></div=
></code></div><br>We would have to add something about being able to write =
dependent using-declarations and having them just do nothing instead of fai=
ling (which is, I think, questionable), but then every function template wo=
uld just be littered with all of these using-declarations for every possibl=
e unqualified call? That seems fairly hostile to library writers.</div></di=
v></blockquote><div><br></div><div>I had a thought recently on the behaviou=
r of using T::f; when there is no such method. If using T::f is simply igno=
red where there are no matching members then it makes it much easier to rem=
ove functions from a type and just keep the ones you want (as available). S=
o I thought if T is a dependent context (same as when forwarding references=
apply) without such members then using T::f should generate no errors but =
just do nothing.</div><div><br></div><div>There are other issues around uni=
versal call syntax, private members and the like though as you mentioned.</=
div><div><br></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/862b5312-4661-4fc0-b4b3-2b78d2fddcc5%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/862b5312-4661-4fc0-b4b3-2b78d2fddcc5=
%40isocpp.org</a>.<br />
------=_Part_1205_649580278.1534642380264--
------=_Part_1204_101695319.1534642380264--
.
Author: mihailnajdenov@gmail.com
Date: Sun, 19 Aug 2018 05:23:48 -0700 (PDT)
Raw View
------=_Part_1296_1306417107.1534681428567
Content-Type: multipart/alternative;
boundary="----=_Part_1297_1643274523.1534681428569"
------=_Part_1297_1643274523.1534681428569
Content-Type: text/plain; charset="UTF-8"
On Sunday, August 19, 2018 at 4:14:07 AM UTC+3, Barry Revzin wrote:
>
>
>
> On Tuesday, August 14, 2018 at 1:03:09 AM UTC-5, mihailn...@gmail.com
> wrote:
>>
>> Hello, I have written a proposal for Unified Call Syntax, based on the
>> previous discussion.
>>
>> https://1drv.ms/u/s!AifghXUnpCc8hAaU7HpR2avsms3b
>>
>>
> It seems like this paper is very focused on attempting to solve the
> problems with the previous UFCS proposals, rather than trying to solve the
> problems that UFCS was trying to solve. As a result, it doesn't actually
> solve the original problems. Here is part of the motivation for N4474:
>
> Having two call syntaxes makes it hard to write generic code: which syntax
>> can we assume from a template argument type? When we start writing
>> concepts, we will either have to support both syntaxes (verbose,
>> potentially doubling the size of concepts) or make assumptions about how
>> objects of certain binds of types are to be invoked (and we may be wrong
>> close to 50% of the time). Today, we already have the problem that many
>> standard-library types are supported by two functions, such as, begin(x)
>> and x.begin(), and swap(x,y) and x.swap(y). This is an increasing problem
>>
>
> and from N4165:
>
> It is a well-known and long-standing problem that C++ has two incompatible
>> calling syntaxes:[...] Unfortunately, this means that calling code must
>> know whether a function is a member function or not. In particular, this
>> syntactic difference defeats writing generic code which must select a
>> single syntax and therefore has no reasonable and direct way to invoke a
>> function f on an object x without first knowing whether f is a member
>> function or not for that type. Because there is no single syntax that can
>> invoke both, it is difficult or impossible to write generic code that can
>> adapt
>>
>
> and from N4174:
>
> This note explores the possibility of providing a uniform call syntax by
>> giving member functions preference over non-member functions. Offering the
>> choice between the x.f(y) and f(x,y) notations with different meanings
>> means that different people will chose differently for their function
>> definitions, so that users have to know the choice and write calls
>> appropriately. This gives users more opportunities for making mistakes,
>> makes it harder to write generic code, and has led to replication when
>> people define both a member and a non-member function to express the same
>> thing. I suggest that providing different meanings to the two syntaxes
>> offers no significant advantage
>>
>
> Now, I don't think generic code is the *only* motivation for having this
> kind of feature - but it was a big motivation for the original papers.
> Basically, being able to, in generic code, write either x.f(y) or f(x, y)
> and have that work regardless if X provides a member f or a non-member f.
>
True, this was the main motivation of the said papers, but this was not the
original motivation.
The original motivation was not about templates, it was about extending
classes one have no access to.
Of course template code made all this *much* more attractive and the
possibility to solve it without an opt in - even more so.
This, however, has failed.
Yet, as the template code can only be truly served by having a default UFC,
the proposal envisions the possibility of eventually switching some default
on, and having a syntax overriding the defaults to match the user needs.
It also envisions migrating the code over a period of time.
The proposal does not exclude UCS as per the original papers.
Meanwhile, the users receive the original feature request!
>
> With your proposal - I still can't do this. In order for f(x, y) to find
> x.f(y), I would have to already know the X::f exists and bring it in with a
> using-declaration. But, if I already know it exists, why wouldn't I just
> write x.f(y) to begin with? I can't write:
>
> template <typename T>
> void algo(T t) {
> using T::f; // what if there is no T::f?
> f(t, Y{});
> }
>
> We would have to add something about being able to write dependent
> using-declarations and having them just do nothing instead of failing
> (which is, I think, questionable), but then every function template would
> just be littered with all of these using-declarations for every possible
> unqualified call? That seems fairly hostile to library writers.
>
> And then, in order for x.f(y) to find f(x, y), I need to redeclare the
> type? This definitely won't work in generic code. Where would I do it? What
> if it's a nested type or a template specialization or ... ?
>
No, this is *user side*, library writes write how they please, knowing the
user can *always* enable the opposite syntax.
// lib
template <typename T> //< assume a concept for T to make the interface
official
void algo(T t) {
f(t, Y{});
}
// user
class C { void f(Y) {} }
// User sees the concept for T, or worst cases, sees an error as f is not
found
// using C::f; //< user choice 1
// void f(Y) {} //< user choice 2
algo(C());
Library writers should not care much about UFC!
In future we *might* make looking into the class default, we *might* use
and improve the syntax to alter the behavior in some way.
The point is having a place to communicate the link b/w the free world and
member world.
>
> Additionally, I'm not sure this opt-in syntax meaningfully addresses the
> concern that I have seen from library authors about allowing x.f(y) to find
> f(x, y) - which is that now if class X adds anything named "f" at all, even
> if it's a private member that users aren't intended to be aware of, it
> breaks user code. This:
>
> Declared this way, if lib::Image ever gets a 'save' method, we will get a
>> redefinition error, instead of silent change of implementation.
>>
>
There are not many details in the proposal, but private members should not
affect the extended interface.
I know current call rules check access last, but this does not have to be
the case when free functions are imported.
class C {};
void f(C&) {}
class C using
{
using f; //< overload only against the public interface
};
// later
class C { void f(C&) {} };
c.f(); //< still calling the free function, we would have errored out
anyway!
Isn't that always correct? Yeah, the free hides the member, but a private
member, not callable anyway.
The only place where this could create problems is when c.f() is called
from C itself, but C has control over what it declares and what it imports.
>
> Doesn't really address their concern. User code is *still broken *by a
> seemingly irrelevant change. Sure, the error might be better - you could
> clearly say that "X::f is a member function but you're trying to say it
> doesn't exist" instead of "error: trying to access private member int"
> which would be incredibly confusing. And if an X::f was added that was
> public and completely compatible with ::f, you would get an error instead
> of silently potentially-different code, which is good. But the point
> remains that user code is still broken.
>
There are multiple stages to pass to get the code broken, and each and
every one is a *user choice:*
1. The user imports his functions into a foreign class public interface
2. The user does NOT accept the future implementation of the function by
the class itself
3. The user uses the dot notation
4. The user does *not* use qualified call.
Compared to a default UCS we have TWO new stages of consent!
And BTW the code can be broken similarly today
namespace lib {
template<class T>
void f(T) { std::cout<<__PRETTY_FUNCTION__<<'\n';}
}
// user
void f(int) { std::cout<<__PRETTY_FUNCTION__<<'\n'; }
using lib::f;
f(5);
If lib decides to add f(int) user code breaks.
> So I'm not sure this is the right direction.
>
> Barry
>
--
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/35b2400e-b308-4dc3-b2aa-7631908adc98%40isocpp.org.
------=_Part_1297_1643274523.1534681428569
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Sunday, August 19, 2018 at 4:14:07 AM UTC+3, Ba=
rry Revzin wrote:<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"><br><br>On Tuesday, August 14, 2018 at 1:03:09 AM UTC-5, <a>mihailn...@=
gmail.com</a> wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;mar=
gin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr=
"><div>Hello, I have written a proposal for Unified Call Syntax, based on t=
he previous discussion.</div><div><br></div><div><a onmousedown=3D"this.hre=
f=3D'https://www.google.com/url?q\x3dhttps%3A%2F%2F1drv.ms%2Fu%2Fs!Aifg=
hXUnpCc8hAaU7HpR2avsms3b\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNG04c6K3LMl=
vdVwqzi6-rDDAAGV3Q';return true;" onclick=3D"this.href=3D'https://w=
ww.google.com/url?q\x3dhttps%3A%2F%2F1drv.ms%2Fu%2Fs!AifghXUnpCc8hAaU7HpR2a=
vsms3b\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNG04c6K3LMlvdVwqzi6-rDDAAGV3Q=
';return true;" href=3D"https://1drv.ms/u/s!AifghXUnpCc8hAaU7HpR2avsms3=
b" target=3D"_blank" rel=3D"nofollow">https://1drv.ms/u/s!<wbr>AifghXUnpCc8=
hAaU7HpR2avsms3b</a></div><div><br></div></div></blockquote><div><br></div>=
<div>It seems like this paper is very focused on attempting to solve the pr=
oblems with the previous UFCS proposals, rather than trying to solve the pr=
oblems that UFCS was trying to solve. As a result, it doesn't actually =
solve the original problems. Here is part of the motivation for N4474:</div=
><div><br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0=
px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Having tw=
o call syntaxes makes it hard to write generic code: which syntax can we as=
sume from a
template argument type? When we start writing concepts, we will either have=
to support both syntaxes
(verbose, potentially doubling the size of concepts) or make assumptions ab=
out how objects of certain
binds of types are to be invoked (and we may be wrong close to 50% of the t=
ime).
Today, we already have the problem that many standard-library types are sup=
ported by two functions,
such as, begin(x) and x.begin(), and swap(x,y) and x.swap(y). This is an in=
creasing problem<br></blockquote><div><br></div><div>and from N4165:</div><=
div><br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px=
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">It is a wel=
l-known and long-standing problem that C++ has two incompatible calling syn=
taxes:[...]=C2=A0Unfortunately, this means that calling code must know whet=
her a function is a member function or not.
In particular, this syntactic difference defeats writing generic code which=
must select a single syntax and
therefore has no reasonable and direct way to invoke a function f on an obj=
ect x without first knowing=20
whether f is a member function or not for that type. Because there is no si=
ngle syntax that can invoke
both, it is difficult or impossible to write generic code that can adapt<br=
></blockquote><div><br></div><div>and from N4174:</div><div><br></div><bloc=
kquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:=
1px solid rgb(204,204,204);padding-left:1ex">This note explores the possibi=
lity of providing a uniform call syntax by giving member functions
preference over non-member functions. Offering the choice between the x.f(y=
) and f(x,y) notations with
different meanings means that different people will chose differently for t=
heir function definitions, so
that users have to know the choice and write calls appropriately. This give=
s users more opportunities for
making mistakes, makes it harder to write generic code, and has led to repl=
ication when people define
both a member and a non-member function to express the same thing. I sugges=
t that providing different
meanings to the two syntaxes offers no significant advantage<br></blockquot=
e><div><br></div><div>Now, I don't think generic code is the <i>only</i=
>=C2=A0motivation for having this kind of feature - but it was a big motiva=
tion for the original papers. Basically, being able to, in generic code, wr=
ite either x.f(y) or f(x, y) and have that work regardless if X provides a =
member f or a non-member f.=C2=A0</div></div></blockquote><div><br></div><d=
iv>True, this was the main motivation of the said papers, but this was not =
the original motivation.</div><div>The original motivation was not about te=
mplates, it was about extending classes one have no access to.=C2=A0<br></d=
iv><div>Of course template code made all this <i>much</i> more attractive a=
nd the possibility to solve it without an opt in - even more so.=C2=A0</div=
><div>This, however, has failed.</div><div><br></div><div>Yet, as the templ=
ate code can only be truly served by having a default UFC, the proposal env=
isions the possibility of eventually switching some default on, and having =
a syntax overriding the defaults to match the user needs.</div><div>It also=
envisions migrating the code over a period of time.</div><div><br></div><d=
iv>The proposal does not exclude UCS as per the original papers.</div><div>=
<br></div><div>Meanwhile, the users receive the original feature request!</=
div><div><br></div><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=
=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: =
1ex;"><div dir=3D"ltr"><div><br></div><div>With your proposal - I still can=
't do this. In order for f(x, y) to find x.f(y), I would have to alread=
y know the X::f exists and bring it in with a using-declaration. But, if I =
already know it exists, why wouldn't I just write x.f(y) to begin with?=
I can't write:</div><div><br></div><div><div style=3D"background-color=
:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-w=
idth:1px;word-wrap:break-word"><code><div><span style=3D"color:#008">templa=
te</span><font color=3D"#666600"><span style=3D"color:#000"> </span><span s=
tyle=3D"color:#660"><</span><span style=3D"color:#008">typename</span><s=
pan style=3D"color:#000"> T</span><span style=3D"color:#660">></span><sp=
an style=3D"color:#000"><br></span><span style=3D"color:#008">void</span><s=
pan style=3D"color:#000"> algo</span><span style=3D"color:#660">(</span><sp=
an style=3D"color:#000">T t</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>=C2=A0 =C2=A0 </span><span style=3D"color:#008">using</=
span><span style=3D"color:#000"> T</span><span style=3D"color:#660">::</spa=
n><span style=3D"color:#000">f</span><span style=3D"color:#660">;</span><sp=
an style=3D"color:#000"> </span><span style=3D"color:#800">// what if there=
is no T::f?</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 f</span><sp=
an style=3D"color:#660">(</span><span style=3D"color:#000">t</span><span st=
yle=3D"color:#660">,</span><span style=3D"color:#000"> Y</span><span style=
=3D"color:#660">{});</span><span style=3D"color:#000"><br></span><span styl=
e=3D"color:#660">}</span></font></div></code></div><br>We would have to add=
something about being able to write dependent using-declarations and havin=
g them just do nothing instead of failing (which is, I think, questionable)=
, but then every function template would just be littered with all of these=
using-declarations for every possible unqualified call? That seems fairly =
hostile to library writers.<br></div></div></blockquote><blockquote class=
=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #cc=
c solid;padding-left: 1ex;"><div dir=3D"ltr"><div><br></div><div>And then, =
in order for x.f(y) to find f(x, y), I need to redeclare the type? This def=
initely won't work in generic code. Where would I do it? What if it'=
;s a nested type or a template specialization or ... ?<br></div></div></blo=
ckquote><div><br></div><div><div style=3D"background-color: transparent; bo=
rder-bottom-color: rgb(34, 34, 34); border-bottom-style: none; border-botto=
m-width: 0px; border-image-outset: 0; border-image-repeat: stretch; border-=
image-slice: 100%; border-image-source: none; border-image-width: 1; border=
-left-color: rgb(34, 34, 34); border-left-style: none; border-left-width: 0=
px; border-right-color: rgb(34, 34, 34); border-right-style: none; border-r=
ight-width: 0px; border-top-color: rgb(34, 34, 34); border-top-style: none;=
border-top-width: 0px; color: rgb(34, 34, 34); font-family: &quot;Aria=
l&quot;,&quot;Helvetica&quot;,sans-serif; font-size: 13px; font=
-style: normal; font-variant: normal; font-weight: 400; letter-spacing: nor=
mal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0=
px; orphans: 2; padding-bottom: 0px; padding-left: 0px; padding-right: 0px;=
padding-top: 0px; text-align: left; text-decoration: none; text-indent: 0p=
x; text-transform: none; -webkit-text-stroke-width: 0px; white-space: norma=
l; word-spacing: 0px;"><br style=3D"background-attachment: scroll; backgrou=
nd-clip: border-box; background-color: transparent; background-image: none;=
background-origin: padding-box; background-position-x: 0%; background-posi=
tion-y: 0%; background-repeat: repeat; background-size: auto; border-bottom=
-color: rgb(34, 34, 34); border-bottom-style: none; border-bottom-width: 0p=
x; border-image-outset: 0; border-image-repeat: stretch; border-image-slice=
: 100%; border-image-source: none; border-image-width: 1; border-left-color=
: rgb(34, 34, 34); border-left-style: none; border-left-width: 0px; border-=
right-color: rgb(34, 34, 34); border-right-style: none; border-right-width:=
0px; border-top-color: rgb(34, 34, 34); border-top-style: none; border-top=
-width: 0px; color: rgb(34, 34, 34); font-family: &quot;Arial&quot;=
,&quot;Helvetica&quot;,sans-serif; font-size: 13px; height: auto; m=
argin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; mi=
n-width: 0px; overflow: visible; overflow-x: visible; overflow-y: visible; =
padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0p=
x;"></div><div style=3D"background-color: transparent; border-bottom-color:=
rgb(34, 34, 34); border-bottom-style: none; border-bottom-width: 0px; bord=
er-image-outset: 0; border-image-repeat: stretch; border-image-slice: 100%;=
border-image-source: none; border-image-width: 1; border-left-color: rgb(3=
4, 34, 34); border-left-style: none; border-left-width: 0px; border-right-c=
olor: rgb(34, 34, 34); border-right-style: none; border-right-width: 0px; b=
order-top-color: rgb(34, 34, 34); border-top-style: none; border-top-width:=
0px; color: rgb(34, 34, 34); font-family: &quot;Arial&quot;,&q=
uot;Helvetica&quot;,sans-serif; font-size: 13px; font-style: normal; fo=
nt-variant: normal; font-weight: 400; letter-spacing: normal; margin-bottom=
: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; pa=
dding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;=
text-align: left; text-decoration: none; text-indent: 0px; text-transform:=
none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0=
px;">No, this is <i>user side</i>, library writes write how they please, kn=
owing the user can <i>always</i> enable the opposite syntax.=C2=A0</div><di=
v style=3D"background-color: transparent; border-bottom-color: rgb(34, 34, =
34); border-bottom-style: none; border-bottom-width: 0px; border-image-outs=
et: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image=
-source: none; border-image-width: 1; border-left-color: rgb(34, 34, 34); b=
order-left-style: none; border-left-width: 0px; border-right-color: rgb(34,=
34, 34); border-right-style: none; border-right-width: 0px; border-top-col=
or: rgb(34, 34, 34); border-top-style: none; border-top-width: 0px; color: =
rgb(34, 34, 34); font-family: &quot;Arial&quot;,&quot;Helvetica=
&quot;,sans-serif; font-size: 13px; font-style: normal; font-variant: n=
ormal; font-weight: 400; letter-spacing: normal; margin-bottom: 0px; margin=
-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; padding-bottom:=
0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: =
left; text-decoration: none; text-indent: 0px; text-transform: none; -webki=
t-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"><br></di=
v><div style=3D"background-color: transparent; border-bottom-color: rgb(34,=
34, 34); border-bottom-style: none; border-bottom-width: 0px; border-image=
-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-=
image-source: none; border-image-width: 1; border-left-color: rgb(34, 34, 3=
4); border-left-style: none; border-left-width: 0px; border-right-color: rg=
b(34, 34, 34); border-right-style: none; border-right-width: 0px; border-to=
p-color: rgb(34, 34, 34); border-top-style: none; border-top-width: 0px; co=
lor: rgb(34, 34, 34); font-family: &quot;Arial&quot;,&quot;Helv=
etica&quot;,sans-serif; font-size: 13px; font-style: normal; font-varia=
nt: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 0px; m=
argin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; padding-bo=
ttom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-al=
ign: left; text-decoration: none; text-indent: 0px; text-transform: none; -=
webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"><fo=
nt face=3D"courier new,monospace">// lib</font></div><div style=3D"backgrou=
nd-color: transparent; border-bottom-color: rgb(34, 34, 34); border-bottom-=
style: none; border-bottom-width: 0px; border-image-outset: 0; border-image=
-repeat: stretch; border-image-slice: 100%; border-image-source: none; bord=
er-image-width: 1; border-left-color: rgb(34, 34, 34); border-left-style: n=
one; border-left-width: 0px; border-right-color: rgb(34, 34, 34); border-ri=
ght-style: none; border-right-width: 0px; border-top-color: rgb(34, 34, 34)=
; border-top-style: none; border-top-width: 0px; color: rgb(34, 34, 34); fo=
nt-family: &quot;Arial&quot;,&quot;Helvetica&quot;,sans-ser=
if; font-size: 13px; font-style: normal; font-variant: normal; font-weight:=
400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-=
right: 0px; margin-top: 0px; orphans: 2; padding-bottom: 0px; padding-left:=
0px; padding-right: 0px; padding-top: 0px; text-align: left; text-decorati=
on: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width=
: 0px; white-space: normal; word-spacing: 0px;"><font face=3D"courier new,m=
onospace"></font><br></div><font face=3D"courier new,monospace">template &l=
t;typename T> //< assume a concept for T to make the interface offici=
al<br>void algo(T t) {<br> f(t, Y{});<br>}</font></div><div><font face=
=3D"courier new,monospace"></font><br></div><div><font face=3D"courier new,=
monospace">// user</font></div><div><font face=3D"courier new,monospace"></=
font><br></div><div><font face=3D"courier new,monospace">class C { void f(Y=
) {} }</font><br><div style=3D"background-color: transparent; border-bottom=
-color: rgb(34, 34, 34); border-bottom-style: none; border-bottom-width: 0p=
x; border-image-outset: 0; border-image-repeat: stretch; border-image-slice=
: 100%; border-image-source: none; border-image-width: 1; border-left-color=
: rgb(34, 34, 34); border-left-style: none; border-left-width: 0px; border-=
right-color: rgb(34, 34, 34); border-right-style: none; border-right-width:=
0px; border-top-color: rgb(34, 34, 34); border-top-style: none; border-top=
-width: 0px; color: rgb(34, 34, 34); font-family: &quot;Arial&quot;=
,&quot;Helvetica&quot;,sans-serif; font-size: 13px; font-style: nor=
mal; font-variant: normal; font-weight: 400; letter-spacing: normal; margin=
-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans=
: 2; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-to=
p: 0px; text-align: left; text-decoration: none; text-indent: 0px; text-tra=
nsform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spa=
cing: 0px;"><font face=3D"courier new,monospace">=C2=A0</font></div><div st=
yle=3D"background-color: transparent; border-bottom-color: rgb(34, 34, 34);=
border-bottom-style: none; border-bottom-width: 0px; border-image-outset: =
0; border-image-repeat: stretch; border-image-slice: 100%; border-image-sou=
rce: none; border-image-width: 1; border-left-color: rgb(34, 34, 34); borde=
r-left-style: none; border-left-width: 0px; border-right-color: rgb(34, 34,=
34); border-right-style: none; border-right-width: 0px; border-top-color: =
rgb(34, 34, 34); border-top-style: none; border-top-width: 0px; color: rgb(=
34, 34, 34); font-family: &quot;Arial&quot;,&quot;Helvetica&=
;quot;,sans-serif; font-size: 13px; font-style: normal; font-variant: norma=
l; font-weight: 400; letter-spacing: normal; margin-bottom: 0px; margin-lef=
t: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; padding-bottom: 0px=
; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left=
; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-te=
xt-stroke-width: 0px; white-space: normal; word-spacing: 0px;"><font face=
=3D"courier new,monospace">// User sees the concept for T, or worst cases, =
sees an error as f is not found</font></div><div style=3D"background-color:=
transparent; border-bottom-color: rgb(34, 34, 34); border-bottom-style: no=
ne; border-bottom-width: 0px; border-image-outset: 0; border-image-repeat: =
stretch; border-image-slice: 100%; border-image-source: none; border-image-=
width: 1; border-left-color: rgb(34, 34, 34); border-left-style: none; bord=
er-left-width: 0px; border-right-color: rgb(34, 34, 34); border-right-style=
: none; border-right-width: 0px; border-top-color: rgb(34, 34, 34); border-=
top-style: none; border-top-width: 0px; color: rgb(34, 34, 34); font-family=
: &quot;Arial&quot;,&quot;Helvetica&quot;,sans-serif; font-=
size: 13px; font-style: normal; font-variant: normal; font-weight: 400; let=
ter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0p=
x; margin-top: 0px; orphans: 2; padding-bottom: 0px; padding-left: 0px; pad=
ding-right: 0px; padding-top: 0px; text-align: left; text-decoration: none;=
text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; wh=
ite-space: normal; word-spacing: 0px;"><font face=3D"courier new,monospace"=
></font><br></div><div style=3D"background-color: transparent; border-botto=
m-color: rgb(34, 34, 34); border-bottom-style: none; border-bottom-width: 0=
px; border-image-outset: 0; border-image-repeat: stretch; border-image-slic=
e: 100%; border-image-source: none; border-image-width: 1; border-left-colo=
r: rgb(34, 34, 34); border-left-style: none; border-left-width: 0px; border=
-right-color: rgb(34, 34, 34); border-right-style: none; border-right-width=
: 0px; border-top-color: rgb(34, 34, 34); border-top-style: none; border-to=
p-width: 0px; color: rgb(34, 34, 34); font-family: &quot;Arial&quot=
;,&quot;Helvetica&quot;,sans-serif; font-size: 13px; font-style: no=
rmal; font-variant: normal; font-weight: 400; letter-spacing: normal; margi=
n-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphan=
s: 2; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-t=
op: 0px; text-align: left; text-decoration: none; text-indent: 0px; text-tr=
ansform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-sp=
acing: 0px;"><font face=3D"courier new,monospace">// using C::f; //< use=
r choice 1</font></div><div style=3D"margin: 0px; padding: 0px; border: 0px=
rgb(34, 34, 34); border-image: none; text-align: left; color: rgb(34, 34, =
34); text-transform: none; text-indent: 0px; letter-spacing: normal; font-s=
ize: 13px; font-variant: normal; word-spacing: 0px; white-space: normal; or=
phans: 2; -webkit-text-stroke-width: 0px; background-color: transparent;"><=
font face=3D"courier new,monospace"></font><span style=3D"display: inline !=
important; float: none; background-color: transparent; color: rgb(34, 34, 3=
4); font-family: courier new,monospace; font-size: 13px; font-style: normal=
; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans: =
2; text-align: left; text-decoration: none; text-indent: 0px; text-transfor=
m: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing:=
0px;"><span style=3D"display: inline !important; float: none; background-c=
olor: transparent; color: rgb(34, 34, 34); font-family: courier new,monospa=
ce; font-size: 13px; font-style: normal; font-variant: normal; font-weight:=
400; letter-spacing: normal; orphans: 2; text-align: left; text-decoration=
: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: =
0px; white-space: normal; word-spacing: 0px;">// void f(Y) {}</span> //<=
user choice 2</span><br></div><div style=3D"background-color: transparent;=
border-bottom-color: rgb(34, 34, 34); border-bottom-style: none; border-bo=
ttom-width: 0px; border-image-outset: 0; border-image-repeat: stretch; bord=
er-image-slice: 100%; border-image-source: none; border-image-width: 1; bor=
der-left-color: rgb(34, 34, 34); border-left-style: none; border-left-width=
: 0px; border-right-color: rgb(34, 34, 34); border-right-style: none; borde=
r-right-width: 0px; border-top-color: rgb(34, 34, 34); border-top-style: no=
ne; border-top-width: 0px; color: rgb(34, 34, 34); font-family: &quot;A=
rial&quot;,&quot;Helvetica&quot;,sans-serif; font-size: 13px; f=
ont-style: normal; font-variant: normal; font-weight: 400; letter-spacing: =
normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top=
: 0px; orphans: 2; padding-bottom: 0px; padding-left: 0px; padding-right: 0=
px; padding-top: 0px; text-align: left; text-decoration: none; text-indent:=
0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: no=
rmal; word-spacing: 0px;"><b></b><i></i><u></u><sub></sub><sup></sup><strik=
e></strike><br></div><div style=3D"background-color: transparent; border-bo=
ttom-color: rgb(34, 34, 34); border-bottom-style: none; border-bottom-width=
: 0px; border-image-outset: 0; border-image-repeat: stretch; border-image-s=
lice: 100%; border-image-source: none; border-image-width: 1; border-left-c=
olor: rgb(34, 34, 34); border-left-style: none; border-left-width: 0px; bor=
der-right-color: rgb(34, 34, 34); border-right-style: none; border-right-wi=
dth: 0px; border-top-color: rgb(34, 34, 34); border-top-style: none; border=
-top-width: 0px; color: rgb(34, 34, 34); font-family: &quot;Arial&q=
uot;,&quot;Helvetica&quot;,sans-serif; font-size: 13px; font-style:=
normal; font-variant: normal; font-weight: 400; letter-spacing: normal; ma=
rgin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orp=
hans: 2; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; paddin=
g-top: 0px; text-align: left; text-decoration: none; text-indent: 0px; text=
-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; word=
-spacing: 0px;"><font face=3D"courier new,monospace">algo(C());</font><br><=
/div></div><div><br></div><div>Library writers should not care much about U=
FC!</div><div><br></div><div><div style=3D"background-color: transparent; b=
order-bottom-color: rgb(34, 34, 34); border-bottom-style: none; border-bott=
om-width: 0px; border-image-outset: 0; border-image-repeat: stretch; border=
-image-slice: 100%; border-image-source: none; border-image-width: 1; borde=
r-left-color: rgb(34, 34, 34); border-left-style: none; border-left-width: =
0px; border-right-color: rgb(34, 34, 34); border-right-style: none; border-=
right-width: 0px; border-top-color: rgb(34, 34, 34); border-top-style: none=
; border-top-width: 0px; color: rgb(34, 34, 34); font-family: &quot;Ari=
al&quot;,&quot;Helvetica&quot;,sans-serif; font-size: 13px; fon=
t-style: normal; font-variant: normal; font-weight: 400; letter-spacing: no=
rmal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: =
0px; orphans: 2; padding-bottom: 0px; padding-left: 0px; padding-right: 0px=
; padding-top: 0px; text-align: left; text-decoration: none; text-indent: 0=
px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: norm=
al; word-spacing: 0px;">In future we <i style=3D"background-attachment: scr=
oll; background-clip: border-box; background-color: transparent; background=
-image: none; background-origin: padding-box; background-position-x: 0%; ba=
ckground-position-y: 0%; background-repeat: repeat; background-size: auto; =
border-bottom-color: rgb(34, 34, 34); border-bottom-style: none; border-bot=
tom-width: 0px; border-image-outset: 0; border-image-repeat: stretch; borde=
r-image-slice: 100%; border-image-source: none; border-image-width: 1; bord=
er-left-color: rgb(34, 34, 34); border-left-style: none; border-left-width:=
0px; border-right-color: rgb(34, 34, 34); border-right-style: none; border=
-right-width: 0px; border-top-color: rgb(34, 34, 34); border-top-style: non=
e; border-top-width: 0px; color: rgb(34, 34, 34); font-family: &quot;Ar=
ial&quot;,&quot;Helvetica&quot;,sans-serif; font-size: 13px; he=
ight: auto; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin=
-top: 0px; min-width: 0px; overflow: visible; overflow-x: visible; overflow=
-y: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; pa=
dding-top: 0px;">might</i> make looking into the class default, we <i style=
=3D"background-attachment: scroll; background-clip: border-box; background-=
color: transparent; background-image: none; background-origin: padding-box;=
background-position-x: 0%; background-position-y: 0%; background-repeat: r=
epeat; background-size: auto; border-bottom-color: rgb(34, 34, 34); border-=
bottom-style: none; border-bottom-width: 0px; border-image-outset: 0; borde=
r-image-repeat: stretch; border-image-slice: 100%; border-image-source: non=
e; border-image-width: 1; border-left-color: rgb(34, 34, 34); border-left-s=
tyle: none; border-left-width: 0px; border-right-color: rgb(34, 34, 34); bo=
rder-right-style: none; border-right-width: 0px; border-top-color: rgb(34, =
34, 34); border-top-style: none; border-top-width: 0px; color: rgb(34, 34, =
34); font-family: &quot;Arial&quot;,&quot;Helvetica&quot;,s=
ans-serif; font-size: 13px; height: auto; margin-bottom: 0px; margin-left: =
0px; margin-right: 0px; margin-top: 0px; min-width: 0px; overflow: visible;=
overflow-x: visible; overflow-y: visible; padding-bottom: 0px; padding-lef=
t: 0px; padding-right: 0px; padding-top: 0px;">might</i> use and improve th=
e syntax to alter the behavior in some way.</div><div style=3D"background-c=
olor: transparent; border-bottom-color: rgb(34, 34, 34); border-bottom-styl=
e: none; border-bottom-width: 0px; border-image-outset: 0; border-image-rep=
eat: stretch; border-image-slice: 100%; border-image-source: none; border-i=
mage-width: 1; border-left-color: rgb(34, 34, 34); border-left-style: none;=
border-left-width: 0px; border-right-color: rgb(34, 34, 34); border-right-=
style: none; border-right-width: 0px; border-top-color: rgb(34, 34, 34); bo=
rder-top-style: none; border-top-width: 0px; color: rgb(34, 34, 34); font-f=
amily: &quot;Arial&quot;,&quot;Helvetica&quot;,sans-serif; =
font-size: 13px; font-style: normal; font-variant: normal; font-weight: 400=
; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-righ=
t: 0px; margin-top: 0px; orphans: 2; padding-bottom: 0px; padding-left: 0px=
; padding-right: 0px; padding-top: 0px; text-align: left; text-decoration: =
none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0p=
x; white-space: normal; word-spacing: 0px;">The point is having a place to =
communicate the link b/w the free world and member world.</div>=C2=A0</div>=
<div>=C2=A0</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></div><div><br></div><div>Additionally, I'm not sure this opt-=
in syntax meaningfully addresses the concern that I have seen from library =
authors about allowing x.f(y) to find f(x, y) - which is that now if class =
X adds anything named "f" at all, even if it's a private memb=
er that users aren't intended to be aware of, it breaks user code. This=
:</div><div><br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px=
0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><p =
style=3D"color:rgb(51,51,51);font-family:Helvetica,arial,freesans,clean,san=
s-serif;font-size:14px">Declared this way, if=C2=A0<code style=3D"border-wi=
dth:1px;border-style:solid;border-color:rgb(234,234,234);font-size:12px;fon=
t-family:Consolas,"Liberation Mono",Courier,monospace;white-space=
:nowrap;background-color:rgb(248,248,248);border-radius:3px">lib::Image</co=
de>=C2=A0ever gets a 'save' method, we will get a redefinition erro=
r, instead of silent change of implementation.</p></blockquote></div></bloc=
kquote><div><br></div><div>There are not many details in the proposal, but =
private members should not affect the extended interface.=C2=A0</div><div><=
br></div><div>I know current call rules check access last, but this does no=
t have to be the case when free functions are imported.</div><div><br></div=
><div><font face=3D"courier new,monospace">class C {};</font></div><div><fo=
nt face=3D"courier new,monospace"></font><br></div><div><font face=3D"couri=
er new,monospace">void f(C&) {}</font></div><div><font face=3D"courier =
new,monospace"></font><br></div><div><font face=3D"courier new,monospace">c=
lass C using</font></div><div><font face=3D"courier new,monospace">{</font>=
</div><div><font face=3D"courier new,monospace">=C2=A0 using f; //< over=
load only against the public interface</font></div><div><font face=3D"couri=
er new,monospace">};</font></div><div><font face=3D"courier new,monospace">=
<br></font></div><div>// later=C2=A0</div><div><br></div><div><span style=
=3D"display: inline !important; float: none; background-color: transparent;=
color: rgb(34, 34, 34); font-family: courier new,monospace; font-size: 13p=
x; font-style: normal; font-variant: normal; font-weight: 400; letter-spaci=
ng: normal; orphans: 2; text-align: left; text-decoration: none; text-inden=
t: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: =
normal; word-spacing: 0px;">class C { <span style=3D"display: inline !impor=
tant; float: none; background-color: transparent; color: rgb(34, 34, 34); f=
ont-family: courier new,monospace; font-size: 13px; font-style: normal; fon=
t-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; te=
xt-align: left; text-decoration: none; text-indent: 0px; text-transform: no=
ne; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;=
">void f(C&) {}</span> };=C2=A0</span></div><div><br></div><div><font f=
ace=3D"courier new,monospace">c.f(); //< still calling the free function=
, we would have errored out anyway!=C2=A0</font></div><div><font face=3D"co=
urier new,monospace"></font><b></b><i></i><u></u><sub></sub><sup></sup><str=
ike></strike><font face=3D"courier new,monospace"></font><br></div><div>Isn=
't that always correct? Yeah, the free hides the member, but a private =
member, not callable anyway.</div><div><br></div><div>The only place where =
this could create problems is when <font face=3D"courier new,monospace">c.f=
()</font> is called from C itself, but C has control over what it declares =
and what it imports.</div><div>=C2=A0</div><blockquote class=3D"gmail_quote=
" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding=
-left: 1ex;"><div dir=3D"ltr"><div><br></div><div>Doesn't really addres=
s their concern. User code is <b>still broken </b>by a seemingly irrelevant=
change. Sure, the error might be better - you could clearly say that "=
;X::f is a member function but you're trying to say it doesn't exis=
t" instead of "error: trying to access private member int" w=
hich would be incredibly confusing. And if an X::f was added that was publi=
c and completely compatible with ::f, you would get an error instead of sil=
ently potentially-different code, which is good. But the point remains that=
user code is still broken.=C2=A0</div></div></blockquote><div><br></div><d=
iv>There are multiple stages to pass to get the code broken, and each and e=
very one is a <i>user choice:</i></div><div><i><br></i></div><ol><li>The us=
er imports his functions into a foreign class public interface</li><li>The =
user does NOT accept the future<span style=3D"display: inline !important; f=
loat: none; background-color: transparent; color: rgb(34, 34, 34); font-fam=
ily: "Arial","Helvetica",sans-serif; font-size: 13px; f=
ont-style: normal; font-variant: normal; font-weight: 400; letter-spacing: =
normal; line-height: 17px; orphans: 2; text-align: left; text-decoration: n=
one; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px=
; white-space: normal; word-spacing: 0px;"> implementation of the function =
by the class itself</span></li><li>The user uses the dot notation</li><li>T=
he user does <i>not</i> use qualified call.</li></ol><div>Compared to a def=
ault UCS we have TWO new stages of consent!=C2=A0</div><div><br></div><div>=
And BTW the code can be broken similarly today</div><div><font face=3D"cour=
ier new,monospace"></font><font face=3D"courier new,monospace"><br>namespac=
e lib {</font></div><div><font face=3D"courier new,monospace">template<c=
lass T><br>void f(T) { std::cout<<__PRETTY_FUNCTION__<<'=
\n';}<br>}</font></div><div><font face=3D"courier new,monospace"><br></=
font></div><div><font face=3D"courier new,monospace">// user</font></div><d=
iv><font face=3D"courier new,monospace"><br></font></div><div><font face=3D=
"courier new,monospace">void f(int) { std::cout<<__PRETTY_FUNCTION__&=
lt;<'\n'; }<br>using lib::f;</font></div><div><font face=3D"cour=
ier new,monospace">=C2=A0=C2=A0<br>f(5);<br></font></div><div><font face=3D=
"courier new,monospace"></font></div><div></div><div>=C2=A0</div><div>If <f=
ont face=3D"courier new,monospace">lib</font> decides to add <font face=3D"=
courier new,monospace">f(int) </font>user code breaks.=C2=A0</div><div><br>=
</div><div><br></div><blockquote class=3D"gmail_quote" style=3D"margin: 0;m=
argin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=
=3D"ltr"><div><br></div><div>So I'm not sure this is the right directio=
n.</div><div><br></div><div>Barry</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" 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/35b2400e-b308-4dc3-b2aa-7631908adc98%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/35b2400e-b308-4dc3-b2aa-7631908adc98=
%40isocpp.org</a>.<br />
------=_Part_1297_1643274523.1534681428569--
------=_Part_1296_1306417107.1534681428567--
.
Author: mihailnajdenov@gmail.com
Date: Tue, 28 Aug 2018 01:16:43 -0700 (PDT)
Raw View
------=_Part_1315_1748222912.1535444203172
Content-Type: multipart/alternative;
boundary="----=_Part_1316_664288681.1535444203172"
------=_Part_1316_664288681.1535444203172
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
In the recent days I was reading a series of posts by =20
<https://quuxplusone.github.io/blog/2018/03/19/customization-points-for-fun=
ctions/#arthur-o-dwyer>Andrzej=20
Krzemie=C5=84ski (link=20
<https://akrzemi1.wordpress.com/2015/11/19/overload-resolution/>, link=20
<https://akrzemi1.wordpress.com/2016/01/16/a-customizable-framework/>) and=
=20
Arthur O=E2=80=99Dwyer (link=20
<https://quuxplusone.github.io/blog/2018/03/19/customization-points-for-fun=
ctions/>,=20
link=20
<https://quuxplusone.github.io/blog/2018/08/23/customization-point-or-named=
-function-pick-one/>
)
To cut the long story short the issue is having a function, that the type=
=20
is able to "specialize" for itself.
The classic example is std::swap - the user overloads the function in its=
=20
namespace then uses using when calling the function in generic code
Although easy to do, two major drawbacks are pointed out in the posts.=20
1. The specialization depends on ADL, so if a foreign type is specialized=
=20
its namespace must be opened. This is problematic for two reasons
- Std namespace (and probably others) is forbidden to be reopened=20
except when explicitly allowed
- The type might silently change namespace. Here is the example given=
=20
by Krzemie=C5=84ski :
namespace boost
{
template <typename T>
class optional;
}
changed to:
namespace boost
{
namespace optional_ns
{=20
template <typename T>
class optional;
}
using namespace optional_ns;
}
2. The using part is easy to miss, using a qualified call instead, missing=
=20
on the specializations completely. =20
Granted there are ways around these deficiencies and they are investigated=
=20
in detail in the posts.
It accrued to me the proposed UFC could be used to alleviate the issues and=
=20
with a tweak can be an interesting alternative.
Consider
namespace my {
void func(std::string) {}
}
class std::string using=20
{
my::func;
};
Now, here is the tweak, we make the func discoverable *without* a using=20
declaration or qualification
auto s =3D "hello"s;
s.func(); //< works
//func(s); //< does not work, as always
This allows us to write trivially customizable code - the user just have to=
=20
add a member function *or* a free standing one, in whatever namespace, and=
=20
import it into the class/type:
namespace some {
template<class T>
void something(T val) { val.to_string(); } *//< no fuss*
}
namespace my {
class Class
{
string to_string() {...}
};
}
namespace utils {
string to_string(int) {...}
}
typename int using=20
{
utils::to_string;
}
some::something(my::Class{}); //< OK
some::something(5); //< OK
Now, in the case int has already has to_string imported
typename int using=20
{
some_dude::to_string;
}
some::something(5); //< ambiguity
We can use the using to select the desired function
using some_dude::to_string;
some::something(5); //< OK
In other words, using declaration does not bring the function into scope,=
=20
it is already there by being imported, but it used to hide other functions.=
=20
Thoughts?=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.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/215c9613-b977-49dc-9564-12be1742da64%40isocpp.or=
g.
------=_Part_1316_664288681.1535444203172
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div><br></div><div>In the recent days I was reading a ser=
ies of posts by=C2=A0<a href=3D"https://quuxplusone.github.io/blog/2018/03/=
19/customization-points-for-functions/#arthur-o-dwyer"></a>Andrzej Krzemie=
=C5=84ski (<a href=3D"https://akrzemi1.wordpress.com/2015/11/19/overload-re=
solution/">link</a>, <a href=3D"https://akrzemi1.wordpress.com/2016/01/16/a=
-customizable-framework/">link</a>) and Arthur O=E2=80=99Dwyer (<a href=3D"=
https://quuxplusone.github.io/blog/2018/03/19/customization-points-for-func=
tions/">link</a>, <a href=3D"https://quuxplusone.github.io/blog/2018/08/23/=
customization-point-or-named-function-pick-one/">link</a>)</div><div><br></=
div><div>To cut the long story short the issue is having a function, that t=
he type is able to "specialize" for itself.</div><div><br></div><=
div>The classic example is <font face=3D"courier new,monospace">std::swap</=
font> - the user overloads the function in its namespace then uses <font fa=
ce=3D"courier new,monospace">using</font> when calling the function in gene=
ric code<br></div><div><br></div><div>Although easy to do, two major drawba=
cks are pointed out in the posts.=C2=A0</div><div><br></div><div>1. The spe=
cialization depends on ADL, so if a foreign type is specialized its namespa=
ce must be opened. This is problematic for two reasons</div><div>=C2=A0 =C2=
=A0 - Std namespace (and probably others) is forbidden to be reopened excep=
t when explicitly allowed</div><div>=C2=A0 =C2=A0 - The type might silently=
change namespace. Here is the example given by <span style=3D"display: inl=
ine !important; float: none; background-color: transparent; color: rgb(34, =
34, 34); font-family: "Arial","Helvetica",sans-serif; f=
ont-size: 13px; font-style: normal; font-variant: normal; font-weight: 400;=
letter-spacing: normal; orphans: 2; text-align: left; text-decoration: non=
e; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; =
white-space: normal; word-spacing: 0px;">Krzemie=C5=84ski </span>:</div><di=
v><font face=3D"courier new,monospace">=C2=A0 namespace boost</font></div><=
div><font face=3D"courier new,monospace">=C2=A0 {</font></div><div><font fa=
ce=3D"courier new,monospace">=C2=A0 =C2=A0 template <typename T></fon=
t></div><div><font face=3D"courier new,monospace">=C2=A0 =C2=A0 class optio=
nal;</font></div><div><font face=3D"courier new,monospace">=C2=A0 }</font><=
/div><div><font face=3D"courier new,monospace"><br></font></div><div>=C2=A0=
changed to:</div><div><font face=3D"courier new,monospace"></font><br></di=
v><div><font face=3D"courier new,monospace">=C2=A0 namespace boost<br>=C2=
=A0 {<br>=C2=A0 =C2=A0 namespace optional_ns<br>=C2=A0 =C2=A0 { <br>=C2=A0 =
=C2=A0 =C2=A0 template <typename T><br>=C2=A0 =C2=A0 =C2=A0 class opt=
ional;<br>=C2=A0 =C2=A0 }</font></div><div><font face=3D"courier new,monosp=
ace">=C2=A0 =C2=A0 using namespace optional_ns;<br>=C2=A0 }</font></div><di=
v><font face=3D"courier new,monospace"><br></font></div><div>2. The <font f=
ace=3D"courier new,monospace">using</font> part is easy to miss, using a qu=
alified call instead, missing on the specializations completely. =C2=A0</di=
v><div><br></div><div>Granted there are ways around these deficiencies and =
they are investigated in detail in the posts.</div><div><br></div><div><br>=
</div><div><br></div><div>It accrued to me the proposed UFC could be used t=
o alleviate the issues and with a tweak can be an interesting alternative.<=
/div><div><br></div><div>Consider</div><div><br></div><div><font face=3D"co=
urier new,monospace">namespace my {</font></div><div><br></div><div><font f=
ace=3D"courier new,monospace">void func(<span style=3D"display: inline !imp=
ortant; float: none; background-color: transparent; color: rgb(34, 34, 34);=
font-family: courier new,monospace; font-size: 13px; font-style: normal; f=
ont-variant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; =
text-align: left; text-decoration: none; text-indent: 0px; text-transform: =
none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0p=
x;">std::string</span>) {}</font></div><div><font face=3D"courier new,monos=
pace"></font><br></div><div><font face=3D"courier new,monospace">}</font></=
div><div><font face=3D"courier new,monospace"></font><br></div><div><font f=
ace=3D"courier new,monospace">class std::string using=C2=A0</font></div><di=
v><font face=3D"courier new,monospace">{</font></div><div><font face=3D"cou=
rier new,monospace">=C2=A0 my::func;</font></div><div><font face=3D"courier=
new,monospace">};</font></div><div><font face=3D"courier new,monospace"></=
font><br></div><div>Now, here is the tweak, we make the func discoverable <=
i>without</i> a <font face=3D"courier new,monospace">using</font> declarati=
on or qualification</div><div><font face=3D"courier new,monospace"></font><=
br></div><div><font face=3D"courier new,monospace">auto s =3D "hello&q=
uot;s;</font></div><div><font face=3D"courier new,monospace"></font><br></d=
iv><div><font face=3D"courier new,monospace">s.func(); //< works</font><=
/div><div><font face=3D"courier new,monospace">//func(s); //< does not w=
ork, as always</font></div><div><font face=3D"courier new,monospace"><br></=
font></div><div>This allows us to write trivially customizable code - the u=
ser just have to add a member function <i>or</i> a free standing one, in wh=
atever namespace, and import it into the class/type:</div><div><br></div><d=
iv><font face=3D"courier new,monospace">namespace some {</font></div><div><=
font face=3D"courier new,monospace"></font><br></div><div><font face=3D"cou=
rier new,monospace">template<class T></font></div><div><font face=3D"=
courier new,monospace">void something(T val) { val.to_string(); } <i>//<=
no fuss</i></font></div><div><font face=3D"courier new,monospace"></font><=
i></i><br></div><div><font face=3D"courier new,monospace">}</font></div><di=
v><font face=3D"courier new,monospace"></font><font face=3D"courier new,mon=
ospace"></font><br></div><div><font face=3D"courier new,monospace">namespac=
e my {</font></div><div><font face=3D"courier new,monospace">class Class</f=
ont></div><div><font face=3D"courier new,monospace">{</font></div><div><fon=
t face=3D"courier new,monospace">=C2=A0 string to_string() {...}</font></di=
v><div><font face=3D"courier new,monospace">};</font></div><div><font face=
=3D"courier new,monospace">}</font></div><div><font face=3D"courier new,mon=
ospace"><br></font></div><div><font face=3D"courier new,monospace">namespac=
e utils {</font></div><div><font face=3D"courier new,monospace"><br></font>=
</div><div><font face=3D"courier new,monospace">string to_string(int) {...}=
</font></div><div><font face=3D"courier new,monospace"><br></font></div><di=
v><font face=3D"courier new,monospace">}</font></div><div><font face=3D"cou=
rier new,monospace"><br></font></div><div><font face=3D"courier new,monospa=
ce">typename int using=C2=A0</font></div><div><font face=3D"courier new,mon=
ospace">{</font></div><div><font face=3D"courier new,monospace">=C2=A0=C2=
=A0<span style=3D"display: inline !important; float: none; background-color=
: transparent; color: rgb(34, 34, 34); font-family: courier new,monospace; =
font-size: 13px; font-style: normal; font-variant: normal; font-weight: 400=
; letter-spacing: normal; orphans: 2; text-align: left; text-decoration: no=
ne; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px;=
white-space: normal; word-spacing: 0px;">utils::<span style=3D"display: in=
line !important; float: none; background-color: transparent; color: rgb(34,=
34, 34); font-family: courier new,monospace; font-size: 13px; font-style: =
normal; font-variant: normal; font-weight: 400; letter-spacing: normal; orp=
hans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-tr=
ansform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-sp=
acing: 0px;">to_string;</span></span></font></div><div><font face=3D"courie=
r new,monospace">}</font><font face=3D"courier new,monospace"><br></font></=
div><div><font face=3D"courier new,monospace"><br></font></div><div><font f=
ace=3D"courier new,monospace"><span style=3D"display: inline !important; fl=
oat: none; background-color: transparent; color: rgb(34, 34, 34); font-fami=
ly: courier new,monospace; font-size: 13px; font-style: normal; font-varian=
t: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align=
: left; text-decoration: none; text-indent: 0px; text-transform: none; -web=
kit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">some::=
something(my::Class{}); //< OK</span></font></div><div><font face=3D"cou=
rier new,monospace"><span style=3D"background-color: transparent; border-bo=
ttom-color: rgb(34, 34, 34); border-bottom-style: none; border-bottom-width=
: 0px; border-image-outset: 0; border-image-repeat: stretch; border-image-s=
lice: 100%; border-image-source: none; border-image-width: 1; border-left-c=
olor: rgb(34, 34, 34); border-left-style: none; border-left-width: 0px; bor=
der-right-color: rgb(34, 34, 34); border-right-style: none; border-right-wi=
dth: 0px; border-top-color: rgb(34, 34, 34); border-top-style: none; border=
-top-width: 0px; color: rgb(34, 34, 34); display: inline; float: none; font=
-family: courier new,monospace; font-size: 13px; font-style: normal; font-v=
ariant: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 0p=
x; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; paddin=
g-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; tex=
t-align: left; text-decoration: none; text-indent: 0px; text-transform: non=
e; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"=
>some::something(5); //< OK</span></font></div><div><font face=3D"courie=
r new,monospace"><br></font></div><div><font face=3D"arial,sans-serif">Now,=
in the case</font><font face=3D"courier new,monospace"> int </font><font f=
ace=3D"arial,sans-serif">has already has <font face=3D"courier new,monospac=
e">to_string</font> imported</font><font face=3D"arial,sans-serif"><br></fo=
nt></div><div><font face=3D"arial,sans-serif"><br></font></div><div><font f=
ace=3D"courier new,monospace"><font face=3D"arial,sans-serif"></font><div s=
tyle=3D"background-color: transparent; border-bottom-color: rgb(34, 34, 34)=
; border-bottom-style: none; border-bottom-width: 0px; border-image-outset:=
0; border-image-repeat: stretch; border-image-slice: 100%; border-image-so=
urce: none; border-image-width: 1; border-left-color: rgb(34, 34, 34); bord=
er-left-style: none; border-left-width: 0px; border-right-color: rgb(34, 34=
, 34); border-right-style: none; border-right-width: 0px; border-top-color:=
rgb(34, 34, 34); border-top-style: none; border-top-width: 0px; color: rgb=
(34, 34, 34); font-family: &quot;Arial&quot;,&quot;Helvetica&am=
p;quot;,sans-serif; font-size: 13px; font-style: normal; font-variant: norm=
al; font-weight: 400; letter-spacing: normal; margin-bottom: 0px; margin-le=
ft: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; padding-bottom: 0p=
x; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: lef=
t; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-t=
ext-stroke-width: 0px; white-space: normal; word-spacing: 0px;"><font face=
=3D"courier new,monospace" style=3D"border-bottom-color: rgb(34, 34, 34); b=
order-bottom-style: none; border-bottom-width: 0px; border-image-outset: 0;=
border-image-repeat: stretch; border-image-slice: 100%; border-image-sourc=
e: none; border-image-width: 1; border-left-color: rgb(34, 34, 34); border-=
left-style: none; border-left-width: 0px; border-right-color: rgb(34, 34, 3=
4); border-right-style: none; border-right-width: 0px; border-top-color: rg=
b(34, 34, 34); border-top-style: none; border-top-width: 0px; margin-bottom=
: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom=
: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">typename i=
nt using=C2=A0</font></div><div style=3D"background-color: transparent; bor=
der-bottom-color: rgb(34, 34, 34); border-bottom-style: none; border-bottom=
-width: 0px; border-image-outset: 0; border-image-repeat: stretch; border-i=
mage-slice: 100%; border-image-source: none; border-image-width: 1; border-=
left-color: rgb(34, 34, 34); border-left-style: none; border-left-width: 0p=
x; border-right-color: rgb(34, 34, 34); border-right-style: none; border-ri=
ght-width: 0px; border-top-color: rgb(34, 34, 34); border-top-style: none; =
border-top-width: 0px; color: rgb(34, 34, 34); font-family: &quot;Arial=
&quot;,&quot;Helvetica&quot;,sans-serif; font-size: 13px; font-=
style: normal; font-variant: normal; font-weight: 400; letter-spacing: norm=
al; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0p=
x; orphans: 2; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; =
padding-top: 0px; text-align: left; text-decoration: none; text-indent: 0px=
; text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal=
; word-spacing: 0px;"><font face=3D"courier new,monospace" style=3D"border-=
bottom-color: rgb(34, 34, 34); border-bottom-style: none; border-bottom-wid=
th: 0px; border-image-outset: 0; border-image-repeat: stretch; border-image=
-slice: 100%; border-image-source: none; border-image-width: 1; border-left=
-color: rgb(34, 34, 34); border-left-style: none; border-left-width: 0px; b=
order-right-color: rgb(34, 34, 34); border-right-style: none; border-right-=
width: 0px; border-top-color: rgb(34, 34, 34); border-top-style: none; bord=
er-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px;=
margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0p=
x; padding-top: 0px;">{</font></div><div style=3D"background-color: transpa=
rent; border-bottom-color: rgb(34, 34, 34); border-bottom-style: none; bord=
er-bottom-width: 0px; border-image-outset: 0; border-image-repeat: stretch;=
border-image-slice: 100%; border-image-source: none; border-image-width: 1=
; border-left-color: rgb(34, 34, 34); border-left-style: none; border-left-=
width: 0px; border-right-color: rgb(34, 34, 34); border-right-style: none; =
border-right-width: 0px; border-top-color: rgb(34, 34, 34); border-top-styl=
e: none; border-top-width: 0px; color: rgb(34, 34, 34); font-family: &q=
uot;Arial&quot;,&quot;Helvetica&quot;,sans-serif; font-size: 13=
px; font-style: normal; font-variant: normal; font-weight: 400; letter-spac=
ing: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margi=
n-top: 0px; orphans: 2; padding-bottom: 0px; padding-left: 0px; padding-rig=
ht: 0px; padding-top: 0px; text-align: left; text-decoration: none; text-in=
dent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-spac=
e: normal; word-spacing: 0px;"><font face=3D"courier new,monospace" style=
=3D"border-bottom-color: rgb(34, 34, 34); border-bottom-style: none; border=
-bottom-width: 0px; border-image-outset: 0; border-image-repeat: stretch; b=
order-image-slice: 100%; border-image-source: none; border-image-width: 1; =
border-left-color: rgb(34, 34, 34); border-left-style: none; border-left-wi=
dth: 0px; border-right-color: rgb(34, 34, 34); border-right-style: none; bo=
rder-right-width: 0px; border-top-color: rgb(34, 34, 34); border-top-style:=
none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-=
right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; paddin=
g-right: 0px; padding-top: 0px;">=C2=A0 <span style=3D"background-color: tr=
ansparent; border-bottom-color: rgb(34, 34, 34); border-bottom-style: none;=
border-bottom-width: 0px; border-image-outset: 0; border-image-repeat: str=
etch; border-image-slice: 100%; border-image-source: none; border-image-wid=
th: 1; border-left-color: rgb(34, 34, 34); border-left-style: none; border-=
left-width: 0px; border-right-color: rgb(34, 34, 34); border-right-style: n=
one; border-right-width: 0px; border-top-color: rgb(34, 34, 34); border-top=
-style: none; border-top-width: 0px; color: rgb(34, 34, 34); display: inlin=
e; float: none; font-family: courier new,monospace; font-size: 13px; font-s=
tyle: normal; font-variant: normal; font-weight: 400; letter-spacing: norma=
l; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px=
; orphans: 2; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; p=
adding-top: 0px; text-align: left; text-decoration: none; text-indent: 0px;=
text-transform: none; -webkit-text-stroke-width: 0px; white-space: normal;=
word-spacing: 0px;">some_dude::<span style=3D"background-color: transparen=
t; border-bottom-color: rgb(34, 34, 34); border-bottom-style: none; border-=
bottom-width: 0px; border-image-outset: 0; border-image-repeat: stretch; bo=
rder-image-slice: 100%; border-image-source: none; border-image-width: 1; b=
order-left-color: rgb(34, 34, 34); border-left-style: none; border-left-wid=
th: 0px; border-right-color: rgb(34, 34, 34); border-right-style: none; bor=
der-right-width: 0px; border-top-color: rgb(34, 34, 34); border-top-style: =
none; border-top-width: 0px; color: rgb(34, 34, 34); display: inline; float=
: none; font-family: courier new,monospace; font-size: 13px; font-style: no=
rmal; font-variant: normal; font-weight: 400; letter-spacing: normal; margi=
n-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphan=
s: 2; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-t=
op: 0px; text-align: left; text-decoration: none; text-indent: 0px; text-tr=
ansform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-sp=
acing: 0px;">to_string;</span></span></font></div><div style=3D"background-=
color: transparent; border-bottom-color: rgb(34, 34, 34); border-bottom-sty=
le: none; border-bottom-width: 0px; border-image-outset: 0; border-image-re=
peat: stretch; border-image-slice: 100%; border-image-source: none; border-=
image-width: 1; border-left-color: rgb(34, 34, 34); border-left-style: none=
; border-left-width: 0px; border-right-color: rgb(34, 34, 34); border-right=
-style: none; border-right-width: 0px; border-top-color: rgb(34, 34, 34); b=
order-top-style: none; border-top-width: 0px; color: rgb(34, 34, 34); font-=
family: &quot;Arial&quot;,&quot;Helvetica&quot;,sans-serif;=
font-size: 13px; font-style: normal; font-variant: normal; font-weight: 40=
0; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-rig=
ht: 0px; margin-top: 0px; orphans: 2; padding-bottom: 0px; padding-left: 0p=
x; padding-right: 0px; padding-top: 0px; text-align: left; text-decoration:=
none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0=
px; white-space: normal; word-spacing: 0px;"><font face=3D"courier new,mono=
space" style=3D"border-bottom-color: rgb(34, 34, 34); border-bottom-style: =
none; border-bottom-width: 0px; border-image-outset: 0; border-image-repeat=
: stretch; border-image-slice: 100%; border-image-source: none; border-imag=
e-width: 1; border-left-color: rgb(34, 34, 34); border-left-style: none; bo=
rder-left-width: 0px; border-right-color: rgb(34, 34, 34); border-right-sty=
le: none; border-right-width: 0px; border-top-color: rgb(34, 34, 34); borde=
r-top-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: =
0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left:=
0px; padding-right: 0px; padding-top: 0px;">}</font><font face=3D"courier =
new,monospace" style=3D"border-bottom-color: rgb(34, 34, 34); border-bottom=
-style: none; border-bottom-width: 0px; border-image-outset: 0; border-imag=
e-repeat: stretch; border-image-slice: 100%; border-image-source: none; bor=
der-image-width: 1; border-left-color: rgb(34, 34, 34); border-left-style: =
none; border-left-width: 0px; border-right-color: rgb(34, 34, 34); border-r=
ight-style: none; border-right-width: 0px; border-top-color: rgb(34, 34, 34=
); border-top-style: none; border-top-width: 0px; margin-bottom: 0px; margi=
n-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; paddi=
ng-left: 0px; padding-right: 0px; padding-top: 0px;"></font></div><div><b><=
/b><i></i><u></u><sub></sub><sup></sup><strike></strike><br></div><div><spa=
n style=3D"display: inline !important; float: none; background-color: trans=
parent; color: rgb(34, 34, 34); font-family: courier new,monospace; font-si=
ze: 13px; font-style: normal; font-variant: normal; font-weight: 400; lette=
r-spacing: normal; orphans: 2; text-align: left; text-decoration: none; tex=
t-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-=
space: normal; word-spacing: 0px;">some::something(5); //< ambiguity</sp=
an><b></b><i></i><u></u><sub></sub><sup></sup><strike></strike><br></div><d=
iv><b></b><i></i><u></u><sub></sub><sup></sup><strike></strike><br></div></=
font><div>We can use the<font face=3D"courier new,monospace"> using </font>=
to select the desired function</div><div><br></div><div><font face=3D"couri=
er new,monospace">using</font>=C2=A0<span style=3D"background-color: transp=
arent; border-bottom-color: rgb(34, 34, 34); border-bottom-style: none; bor=
der-bottom-width: 0px; border-image-outset: 0; border-image-repeat: stretch=
; border-image-slice: 100%; border-image-source: none; border-image-width: =
1; border-left-color: rgb(34, 34, 34); border-left-style: none; border-left=
-width: 0px; border-right-color: rgb(34, 34, 34); border-right-style: none;=
border-right-width: 0px; border-top-color: rgb(34, 34, 34); border-top-sty=
le: none; border-top-width: 0px; color: rgb(34, 34, 34); display: inline; f=
loat: none; font-family: courier new,monospace; font-size: 13px; font-style=
: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; m=
argin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; or=
phans: 2; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; paddi=
ng-top: 0px; text-align: left; text-decoration: none; text-indent: 0px; tex=
t-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; wor=
d-spacing: 0px;">some_dude::<span style=3D"background-color: transparent; b=
order-bottom-color: rgb(34, 34, 34); border-bottom-style: none; border-bott=
om-width: 0px; border-image-outset: 0; border-image-repeat: stretch; border=
-image-slice: 100%; border-image-source: none; border-image-width: 1; borde=
r-left-color: rgb(34, 34, 34); border-left-style: none; border-left-width: =
0px; border-right-color: rgb(34, 34, 34); border-right-style: none; border-=
right-width: 0px; border-top-color: rgb(34, 34, 34); border-top-style: none=
; border-top-width: 0px; color: rgb(34, 34, 34); display: inline; float: no=
ne; font-family: courier new,monospace; font-size: 13px; font-style: normal=
; font-variant: normal; font-weight: 400; letter-spacing: normal; margin-bo=
ttom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2=
; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: =
0px; text-align: left; text-decoration: none; text-indent: 0px; text-transf=
orm: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spacin=
g: 0px;">to_string;</span></span></div><font face=3D"courier new,monospace"=
><div><b></b><i></i><u></u><sub></sub><sup></sup><strike></strike><b></b><i=
></i><u></u><sub></sub><sup></sup><strike></strike><br></div><div><span sty=
le=3D"display: inline !important; float: none; background-color: transparen=
t; color: rgb(34, 34, 34); font-family: courier new,monospace; font-size: 1=
3px; font-style: normal; font-variant: normal; font-weight: 400; letter-spa=
cing: normal; orphans: 2; text-align: left; text-decoration: none; text-ind=
ent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space=
: normal; word-spacing: 0px;">some::something(5); //< OK</span><b></b><i=
></i><u></u><sub></sub><sup></sup><strike></strike><br></div></font></div><=
div><br></div><div>In other words, <font face=3D"courier new,monospace">usi=
ng</font> declaration does not bring the function into scope, it is already=
there by being imported, but it used to hide other functions.=C2=A0<br></d=
iv><div><br></div><div><br></div><div>Thoughts?=C2=A0</div><div><br></div><=
/div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/215c9613-b977-49dc-9564-12be1742da64%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/215c9613-b977-49dc-9564-12be1742da64=
%40isocpp.org</a>.<br />
------=_Part_1316_664288681.1535444203172--
------=_Part_1315_1748222912.1535444203172--
.
Author: mihailnajdenov@gmail.com
Date: Sat, 1 Sep 2018 02:09:48 -0700 (PDT)
Raw View
------=_Part_1047_1406536709.1535792988297
Content-Type: multipart/alternative;
boundary="----=_Part_1048_1663117502.1535792988297"
------=_Part_1048_1663117502.1535792988297
Content-Type: text/plain; charset="UTF-8"
Updated the file to accommodate the comments made thus far + added a small
section about pointers.
On Tuesday, August 14, 2018 at 9:03:09 AM UTC+3, mihailn...@gmail.com wrote:
>
> Hello, I have written a proposal for Unified Call Syntax, based on the
> previous discussion.
>
> https://1drv.ms/u/s!AifghXUnpCc8hAaU7HpR2avsms3b
>
>
> Feedback is welcome.
>
>
> PS. This is the fifth attempt to post, hence the link instead of an
> attachment.
>
--
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/6bdac20e-4b60-40ec-aebc-ebe25173eb68%40isocpp.org.
------=_Part_1048_1663117502.1535792988297
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Updated the file to accommodate the comments made thus far=
+ added a small section about pointers.=C2=A0<br><br>On Tuesday, August 14=
, 2018 at 9:03:09 AM UTC+3, mihailn...@gmail.com wrote:<blockquote class=3D=
"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc s=
olid;padding-left: 1ex;"><div dir=3D"ltr"><div>Hello, I have written a prop=
osal for Unified Call Syntax, based on the previous discussion.</div><div><=
br></div><div><a onmousedown=3D"this.href=3D'https://www.google.com/url=
?q\x3dhttps%3A%2F%2F1drv.ms%2Fu%2Fs!AifghXUnpCc8hAaU7HpR2avsms3b\x26sa\x3dD=
\x26sntz\x3d1\x26usg\x3dAFQjCNG04c6K3LMlvdVwqzi6-rDDAAGV3Q';return true=
;" onclick=3D"this.href=3D'https://www.google.com/url?q\x3dhttps%3A%2F%=
2F1drv.ms%2Fu%2Fs!AifghXUnpCc8hAaU7HpR2avsms3b\x26sa\x3dD\x26sntz\x3d1\x26u=
sg\x3dAFQjCNG04c6K3LMlvdVwqzi6-rDDAAGV3Q';return true;" href=3D"https:/=
/1drv.ms/u/s!AifghXUnpCc8hAaU7HpR2avsms3b" target=3D"_blank" rel=3D"nofollo=
w">https://1drv.ms/u/s!<wbr>AifghXUnpCc8hAaU7HpR2avsms3b</a></div><div><br>=
</div><div><br></div><div><div>Feedback is welcome.</div><b></b><i></i><u><=
/u><sub></sub><sup></sup><strike></strike><br></div><div><b></b><i></i><u><=
/u><sub></sub><sup></sup><strike></strike><br></div><div>PS. This is the fi=
fth attempt to post, hence the link instead of an attachment.=C2=A0</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" 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/6bdac20e-4b60-40ec-aebc-ebe25173eb68%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/6bdac20e-4b60-40ec-aebc-ebe25173eb68=
%40isocpp.org</a>.<br />
------=_Part_1048_1663117502.1535792988297--
------=_Part_1047_1406536709.1535792988297--
.
Author: mihailnajdenov@gmail.com
Date: Tue, 23 Oct 2018 02:14:30 -0700 (PDT)
Raw View
------=_Part_588_1822484922.1540286070348
Content-Type: multipart/alternative;
boundary="----=_Part_589_2095983288.1540286070349"
------=_Part_589_2095983288.1540286070349
Content-Type: text/plain; charset="UTF-8"
Updated the file to include the observation this technique might be used to
support "Operator Dot"-type of access.
Example
template <class T>
class reference_wrapper {
public:
reference_wrapper(T& ref) noexcept : _ptr(std::addressof(ref)) {}
reference_wrapper(T&&) = delete;
reference_wrapper(const reference_wrapper&) noexcept = default;
reference_wrapper& operator=(const reference_wrapper& x) noexcept =
default;
// access
operator T& () const noexcept { return *_ptr; }
...
private:
T* _ptr;
};
// deduction guides
template<class T>
reference_wrapper(reference_wrapper<T>) -> reference_wrapper<T>;
// associated members
template <class T>
class reference_wrapper using
{
T::*; //< introduce all members from the class we wrap (because we are
convertible to it!)
};
// usage
std::string s = "hello";
auto rs = reference_wrapper(s);
rs[0]; //< std::string::operator[]
The last call will be as-if
1) std::string operator[](const std::string&, std::size_t); //< "free
function"
2) operator[](rs.operator std::string&(), 0); //< call
The updated file also has a section about a possible extension to have
associated function have a different name
typename std::meta::info using
{
name = name_of; //< rename
type = type_of; //<
}
info.type().name();
instead of
info.type_of().name_of();
On Tuesday, August 14, 2018 at 9:03:09 AM UTC+3, mihailn...@gmail.com wrote:
>
> Hello, I have written a proposal for Unified Call Syntax, based on the
> previous discussion.
>
> https://1drv.ms/u/s!AifghXUnpCc8hAaU7HpR2avsms3b
>
>
> Feedback is welcome.
>
>
> PS. This is the fifth attempt to post, hence the link instead of an
> attachment.
>
--
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/8a9089b8-c4f7-4fff-bfce-4bce30e7c46c%40isocpp.org.
------=_Part_589_2095983288.1540286070349
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Updated the file to include the observation this technique=
might be used to support "Operator Dot"-type of access.<div><br>=
</div><div>Example</div><font face=3D"courier new, monospace"><br>template =
<class T><br> class reference_wrapper {<br>public:<br>=C2=A0 referenc=
e_wrapper(T& ref) noexcept : _ptr(std::addressof(ref)) {}<br>=C2=A0 ref=
erence_wrapper(T&&) =3D delete;<br>=C2=A0 reference_wrapper(const r=
eference_wrapper&) noexcept =3D default;<br>=C2=A0 reference_wrapper&am=
p; operator=3D(const reference_wrapper& x) noexcept =3D default;<br> <=
br>=C2=A0 // access<br>=C2=A0 operator T& () const noexcept { return *_=
ptr; }<br>=C2=A0 ...<br> <br> private:<br>=C2=A0 T* _ptr;<br> };<br> <br> =
// deduction guides<br> template<class T><br> reference_wrapper(refer=
ence_wrapper<T>) -> reference_wrapper<T>;<br> <br> // associ=
ated members<br> template <class T><br> class reference_wrapper using=
<br> { <br>=C2=A0 T::*; //< introduce all members from the class we wrap=
(because we are convertible=C2=A0to it!)<br> };<br><br>// usage<br> <br> s=
td::string s =3D "hello";<br> auto rs =3D reference_wrapper(s);<b=
r><br> rs[0]; //< std::string::operator[]</font><div><font face=3D"couri=
er new, monospace"><br></font></div><div><font face=3D"arial, sans-serif">T=
he last call will be as-if</font></div><div><font face=3D"courier new, mono=
space"><br></font></div><div><font face=3D"courier new, monospace">1) std::=
string=C2=A0</font><span style=3D"font-family: "courier new", mon=
ospace;">operator[](const std::string&, std::size_t); //< "free=
function"</span></div><div><span style=3D"font-family: "courier =
new", monospace;">2) operator[](</span><span style=3D"font-family: &qu=
ot;courier new", monospace;">rs.</span><span style=3D"font-family: &qu=
ot;courier new", monospace;">operator std::string&(), 0</span><spa=
n style=3D"font-family: "courier new", monospace;">); //< call=
</span></div><div><font face=3D"courier new, monospace"><br></font></div><d=
iv><font face=3D"arial, sans-serif">The updated file also has a section abo=
ut a possible extension to have associated function have a different name</=
font></div><div><font face=3D"arial, sans-serif"><br></font></div><font fac=
e=3D"courier new, monospace">typename std::meta::info using<br> {<br>=C2=A0=
name =3D name_of; //< rename<br>=C2=A0 type =3D type_of; //<<br> }</=
font><div><font face=3D"courier new, monospace"><br></font><div><font face=
=3D"courier new, monospace">info.type().name();</font></div><div><font face=
=3D"courier new, monospace"><br></font></div><div><font face=3D"arial, sans=
-serif">instead of</font></div><div><font face=3D"arial, sans-serif"><br></=
font></div><div><font face=3D"courier new, monospace">info.type_of().name_o=
f();</font></div><div><font face=3D"courier new, monospace"><br></font><div=
><div>On Tuesday, August 14, 2018 at 9:03:09 AM UTC+3, mihailn...@gmail.com=
wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.=
8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div>H=
ello, I have written a proposal for Unified Call Syntax, based on the previ=
ous discussion.</div><div><br></div><div><a href=3D"https://1drv.ms/u/s!Aif=
ghXUnpCc8hAaU7HpR2avsms3b" target=3D"_blank" rel=3D"nofollow" onmousedown=
=3D"this.href=3D'https://www.google.com/url?q\x3dhttps%3A%2F%2F1drv.ms%=
2Fu%2Fs!AifghXUnpCc8hAaU7HpR2avsms3b\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQj=
CNG04c6K3LMlvdVwqzi6-rDDAAGV3Q';return true;" onclick=3D"this.href=3D&#=
39;https://www.google.com/url?q\x3dhttps%3A%2F%2F1drv.ms%2Fu%2Fs!AifghXUnpC=
c8hAaU7HpR2avsms3b\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNG04c6K3LMlvdVwqz=
i6-rDDAAGV3Q';return true;">https://1drv.ms/u/s!<wbr>AifghXUnpCc8hAaU7H=
pR2avsms3b</a></div><div><br></div><div><br></div><div><div>Feedback is wel=
come.</div><b></b><i></i><u></u><sub></sub><sup></sup><strike></strike><br>=
</div><div><b></b><i></i><u></u><sub></sub><sup></sup><strike></strike><br>=
</div><div>PS. This is the fifth attempt to post, hence the link instead of=
an attachment.=C2=A0</div></div></blockquote></div></div></div></div></div=
>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" 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/8a9089b8-c4f7-4fff-bfce-4bce30e7c46c%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/8a9089b8-c4f7-4fff-bfce-4bce30e7c46c=
%40isocpp.org</a>.<br />
------=_Part_589_2095983288.1540286070349--
------=_Part_588_1822484922.1540286070348--
.