Topic: Strong named arguments as tag overloads
Author: mihailnajdenov@gmail.com
Date: Mon, 9 Jul 2018 03:00:59 -0700 (PDT)
Raw View
------=_Part_63244_1662166373.1531130459200
Content-Type: multipart/alternative;
boundary="----=_Part_63245_458462203.1531130459200"
------=_Part_63245_458462203.1531130459200
Content-Type: text/plain; charset="UTF-8"
I got an idea this morning, here it is in code
void func( width: int val );
void func( height: int val );
// compiler generates
// template<auto& name>
// class func_tag{ };
//
// void func( func_tag<"width">, int val );
// void func( func_tag<"height">, int val );
template<class... Args>
void ff(Args&&... args)
{
func(std::forward<Arsg>(args)...);
}
int main()
{
func(height: 12);
func(width: 33);
ff(12) //< error: can't convert 12 to width/height
ff(width: 22); //< works!
return 0;
}
Basically this is a syntax sugar for the tag dispatch idiom.
template< class... Args1, class... Args2 >
pair(piecewise: tuple<Args1...> first_args, tuple<Args2...> second_args);
Note, both weak named arguments (transparent to pointers, optional) and
strong named arguments (overload contribution) have their place!
This is not a solution for all uses of named arguments, just an improvement
on already established practice.
Feedback is welcome!
P.S. Advanced example
auto a = any(in_place<string>: 3, 'A');
template< class ValueType, class... Args >
explicit any( in_place<ValueType>: Args&&... args );
// Compiler:
// template<auto& name, class T>
// class typed_tag{ };
//
// template<class T>
// using in_place_tag = typed_tag<"in_place",T>;
//
//
// template< class ValueType, class... Args >
// explicit any( in_place_tag<ValueType>, Args&&... args );
Basically we can have beautiful and teachable interfaces and the tag stays
as implementation detail.
--
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/45cdc03c-1370-4ac3-a8ff-334dcc8884b3%40isocpp.org.
------=_Part_63245_458462203.1531130459200
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div><br></div><div>I got an idea this morning, here it is=
in code</div><div><br></div><div><font face=3D"courier new,monospace"><br>=
</font></div><div><font face=3D"courier new,monospace">void func(=C2=A0 wid=
th: int val );<br>void func(=C2=A0 height: int val );</font></div><div><fon=
t face=3D"courier new,monospace"><br></font></div><div><font face=3D"courie=
r new,monospace">// compiler generates</font></div><div><font face=3D"couri=
er new,monospace"><br></font></div><div><font face=3D"courier new,monospace=
">// template<auto& name> <br>// class <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;">func_</span>tag{ };</font></div><div><font face=3D"courier new=
,monospace">//</font></div><div><font face=3D"courier new,monospace">// voi=
d func(=C2=A0 <span style=3D"display: inline !important; float: none; backg=
round-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-dec=
oration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-=
width: 0px; white-space: normal; word-spacing: 0px;">func_</span>tag<&qu=
ot;width">, int val );<br>// void func(=C2=A0 <span style=3D"displa=
y: inline !important; float: none; background-color: transparent; color: rg=
b(34, 34, 34); font-family: courier new,monospace; font-size: 13px; font-st=
yle: normal; font-variant: normal; font-weight: 400; letter-spacing: normal=
; orphans: 2; text-align: left; text-decoration: none; text-indent: 0px; te=
xt-transform: none; -webkit-text-stroke-width: 0px; white-space: normal; wo=
rd-spacing: 0px;">func_</span>tag<"height">, int val );<br>=
=C2=A0=C2=A0=C2=A0 </font></div><div><font face=3D"courier new,monospace">t=
emplate<class... Args><br>void ff(Args&&... args)<br>{<br>=C2=
=A0=C2=A0=C2=A0 func(std::forward<Arsg>(args)...);<br>}<br>=C2=A0=C2=
=A0=C2=A0 <br>int main()<br>{<br>=C2=A0=C2=A0=C2=A0 func(height: 12);<br>=
=C2=A0=C2=A0=C2=A0 func(width: 33);<br>=C2=A0 <br>=C2=A0=C2=A0=C2=A0 ff(12)=
//< error: can't convert 12 to width/height<br>=C2=A0=C2=A0=C2=A0 f=
f(width: 22); //< works!<br>=C2=A0=C2=A0=C2=A0 <br>=C2=A0=C2=A0=C2=A0 re=
turn 0;<br>}</font><br></div><div><font face=3D"courier new,monospace"></fo=
nt><br></div><div><br></div><div>Basically this is a syntax sugar for the t=
ag dispatch idiom.</div><div><br></div><div><br></div><font face=3D"courier=
new,monospace">template< class... Args1, class... Args2 ><br></font>=
<div><font face=3D"courier new,monospace">pair(piecewise: tuple<Args1...=
> first_args, tuple<Args2...> second_args);</font></div><br><div><=
font face=3D"courier new,monospace"><div></div><div><br></div></font><div><=
font face=3D"arial,sans-serif">Note, both weak<span style=3D"display: inlin=
e !important; float: none; background-color: transparent; color: rgb(34, 34=
, 34); font-family: arial,sans-serif; 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: 0=
px;"> named arguments</span> (transparent to pointers, optional) and strong=
named arguments (overload contribution) have their place!</font></div><div=
><font face=3D"arial,sans-serif">This is not a solution for all uses of nam=
ed arguments, just an improvement on already established practice.</font></=
div><div><font face=3D"arial,sans-serif"><br></font></div><div><font face=
=3D"arial,sans-serif">Feedback is welcome!</font></div></div><div><font fac=
e=3D"arial,sans-serif"></font><br></div><div><br></div><div>P.S. Advanced e=
xample</div><div><b></b><i></i><u></u><sub></sub><sup></sup><strike></strik=
e><br></div><div><font face=3D"courier new,monospace">auto a =3D any(in_pla=
ce<string>: 3, 'A');</font></div><div><font face=3D"courier n=
ew,monospace"></font><br></div><div><br 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: courier new,=
monospace; font-size: 13px; font-style: normal; font-variant: normal; font-=
weight: 400; height: auto; letter-spacing: normal; margin-bottom: 0px; marg=
in-left: 0px; margin-right: 0px; margin-top: 0px; min-width: 0px; orphans: =
2; overflow: visible; overflow-x: visible; overflow-y: visible; padding-bot=
tom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-ali=
gn: left; text-decoration: none; text-indent: 0px; text-transform: none; -w=
ebkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"><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;">template< class ValueType, class... A=
rgs ></span><br style=3D"background-attachment: scroll; background-clip:=
border-box; background-color: transparent; background-image: none; backgro=
und-origin: padding-box; background-position-x: 0%; background-position-y: =
0%; background-repeat: repeat; background-size: auto; border-bottom-color: =
rgb(34, 34, 34); border-bottom-style: none; border-bottom-width: 0px; borde=
r-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-co=
lor: rgb(34, 34, 34); border-right-style: none; border-right-width: 0px; bo=
rder-top-color: rgb(34, 34, 34); border-top-style: none; border-top-width: =
0px; color: rgb(34, 34, 34); font-family: courier new,monospace; font-size:=
13px; font-style: normal; font-variant: normal; font-weight: 400; height: =
auto; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-=
right: 0px; margin-top: 0px; min-width: 0px; orphans: 2; overflow: visible;=
overflow-x: visible; overflow-y: visible; 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;"><span style=3D"display: i=
nline !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; or=
phans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-t=
ransform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-s=
pacing: 0px;"> </span><span style=3D"display: inline !important; float: non=
e; background-color: transparent; color: rgb(34, 34, 34); font-family: cour=
ier new,monospace; font-size: 13px; font-style: normal; font-variant: norma=
l; 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;">explicit any( =
</span><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;">in_place</span><span style=3D=
"display: inline !important; float: none; background-color: transparent; co=
lor: 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: none; text-indent: =
0px; text-transform: none; -webkit-text-stroke-width: 0px; white-space: nor=
mal; word-spacing: 0px;"><ValueType>: Args&&... args );</span=
></div><div><b></b><i></i><u></u><sub></sub><sup></sup><strike></strike><br=
></div><div><font face=3D"courier new,monospace">// Compiler:</font></div><=
div><font face=3D"courier new,monospace"></font><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;">// template<auto& name, class T> </sp=
an><br 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%; backgrou=
nd-repeat: repeat; background-size: auto; 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: courier new,monospace; font-size: 13px; font-=
style: normal; font-variant: normal; font-weight: 400; height: auto; letter=
-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; =
margin-top: 0px; min-width: 0px; orphans: 2; overflow: visible; overflow-x:=
visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padd=
ing-right: 0px; padding-top: 0px; text-align: left; text-decoration: none; =
text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; whi=
te-space: normal; word-spacing: 0px;"><font face=3D"courier new,monospace">=
<span style=3D"text-align: left; color: rgb(34, 34, 34); text-transform: no=
ne; text-indent: 0px; letter-spacing: normal; font-size: 13px; font-style: =
normal; font-variant: normal; font-weight: 400; text-decoration: none; word=
-spacing: 0px; display: inline !important; white-space: normal; orphans: 2;=
float: none; -webkit-text-stroke-width: 0px; background-color: transparent=
;">// class <span style=3D"text-align: left; color: rgb(34, 34, 34); text-t=
ransform: none; text-indent: 0px; letter-spacing: normal; font-size: 13px; =
font-style: normal; font-variant: normal; font-weight: 400; text-decoration=
: none; word-spacing: 0px; display: inline !important; white-space: normal;=
orphans: 2; float: none; -webkit-text-stroke-width: 0px; background-color:=
transparent;">typed</span></span><span 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: no=
rmal; font-size: 13px; font-style: normal; font-variant: normal; font-weigh=
t: 400; text-decoration: none; word-spacing: 0px; display: inline; white-sp=
ace: normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; backg=
round-color: transparent;">_</span><span style=3D"text-align: left; color: =
rgb(34, 34, 34); text-transform: none; text-indent: 0px; letter-spacing: no=
rmal; font-size: 13px; font-style: normal; font-variant: normal; font-weigh=
t: 400; text-decoration: none; word-spacing: 0px; display: inline !importan=
t; white-space: normal; orphans: 2; float: none; -webkit-text-stroke-width:=
0px; background-color: transparent;">tag{ };</span></font><b></b><i></i><u=
></u><sub></sub><sup></sup><strike></strike></div><div><font face=3D"courie=
r new,monospace">//=C2=A0</font></div><div><font face=3D"courier new,monosp=
ace">// template<class T></font></div><div><font face=3D"courier new,=
monospace">// using=C2=A0<span style=3D"background-color: transparent; bord=
er-bottom-color: rgb(34, 34, 34); border-bottom-style: none; border-bottom-=
width: 0px; border-image-outset: 0; border-image-repeat: stretch; border-im=
age-slice: 100%; border-image-source: none; border-image-width: 1; border-l=
eft-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-rig=
ht-width: 0px; border-top-color: rgb(34, 34, 34); border-top-style: none; b=
order-top-width: 0px; color: rgb(34, 34, 34); display: inline; float: none;=
font-family: courier new,monospace; font-size: 13px; font-style: normal; f=
ont-variant: normal; font-weight: 400; letter-spacing: normal; margin-botto=
m: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; p=
adding-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;">in_place</span><span style=3D"background-color: transparent; border-b=
ottom-color: rgb(34, 34, 34); border-bottom-style: none; border-bottom-widt=
h: 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; bo=
rder-right-color: rgb(34, 34, 34); border-right-style: none; border-right-w=
idth: 0px; border-top-color: rgb(34, 34, 34); border-top-style: none; borde=
r-top-width: 0px; color: rgb(34, 34, 34); display: inline; float: none; fon=
t-family: courier new,monospace; font-size: 13px; font-style: normal; font-=
variant: normal; font-weight: 400; letter-spacing: normal; margin-bottom: 0=
px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orphans: 2; paddi=
ng-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; 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;=
">_</span><span style=3D"background-color: transparent; border-bottom-color=
: rgb(34, 34, 34); border-bottom-style: none; border-bottom-width: 0px; bor=
der-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); display: inline; float: none; font-family: c=
ourier new,monospace; font-size: 13px; font-style: normal; font-variant: no=
rmal; 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: l=
eft; text-decoration: none; text-indent: 0px; text-transform: none; -webkit=
-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">tag =3D <=
span style=3D"background-color: transparent; border-bottom-color: rgb(34, 3=
4, 34); border-bottom-style: none; border-bottom-width: 0px; border-image-o=
utset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-im=
age-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; colo=
r: rgb(34, 34, 34); display: inline; float: none; font-family: courier new,=
monospace; 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; paddin=
g-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; text-d=
ecoration: none; text-indent: 0px; text-transform: none; -webkit-text-strok=
e-width: 0px; white-space: normal; word-spacing: 0px;"><span style=3D"backg=
round-color: transparent; border-bottom-color: rgb(34, 34, 34); border-bott=
om-style: none; border-bottom-width: 0px; border-image-outset: 0; border-im=
age-repeat: stretch; border-image-slice: 100%; border-image-source: none; b=
order-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);=
display: inline; float: none; font-family: courier new,monospace; font-siz=
e: 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; paddin=
g-right: 0px; padding-top: 0px; text-align: left; text-decoration: none; te=
xt-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white=
-space: normal; word-spacing: 0px;">typed</span></span><span style=3D"backg=
round-color: transparent; border-bottom-color: rgb(34, 34, 34); border-bott=
om-style: none; border-bottom-width: 0px; border-image-outset: 0; border-im=
age-repeat: stretch; border-image-slice: 100%; border-image-source: none; b=
order-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);=
display: inline; float: none; font-family: courier new,monospace; font-siz=
e: 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; paddin=
g-right: 0px; padding-top: 0px; text-align: left; text-decoration: none; te=
xt-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white=
-space: normal; word-spacing: 0px;"></span><span 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); display: in=
line; float: none; font-family: courier new,monospace; 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;">_</span><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;">tag</span><"in_place",T>;</span></font></div><=
div><font face=3D"courier new,monospace"><span style=3D"background-color: t=
ransparent; border-bottom-color: rgb(34, 34, 34); border-bottom-style: none=
; border-bottom-width: 0px; border-image-outset: 0; border-image-repeat: st=
retch; border-image-slice: 100%; border-image-source: none; border-image-wi=
dth: 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-to=
p-style: none; border-top-width: 0px; color: rgb(34, 34, 34); display: inli=
ne; float: none; font-family: courier new,monospace; 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;">//</span></font></div><div><font face=3D"courier new,=
monospace"><span style=3D"background-color: transparent; border-bottom-colo=
r: rgb(34, 34, 34); border-bottom-style: none; border-bottom-width: 0px; bo=
rder-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-widt=
h: 0px; color: rgb(34, 34, 34); display: inline; float: none; font-family: =
courier new,monospace; 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;">//</span=
></font></div><div><font face=3D"courier new,monospace"><span style=3D"disp=
lay: 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: norm=
al; 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;">// template< class ValueType, class... Args ></sp=
an><br 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%; backgrou=
nd-repeat: repeat; background-size: auto; 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: courier new,monospace; font-size: 13px; font-=
style: normal; font-variant: normal; font-weight: 400; height: auto; letter=
-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; =
margin-top: 0px; min-width: 0px; orphans: 2; overflow: visible; overflow-x:=
visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padd=
ing-right: 0px; padding-top: 0px; text-align: left; text-decoration: none; =
text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; whi=
te-space: normal; word-spacing: 0px;"><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;=
"></span><span style=3D"display: inline !important; float: none; background=
-color: transparent; color: rgb(34, 34, 34); font-family: courier new,monos=
pace; font-size: 13px; font-style: normal; font-variant: normal; font-weigh=
t: 400; letter-spacing: normal; orphans: 2; text-align: left; text-decorati=
on: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-width=
: 0px; white-space: normal; word-spacing: 0px;">// explicit any( <span styl=
e=3D"background-color: transparent; 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; color: rgb(34=
, 34, 34); display: inline; float: none; font-family: courier new,monospace=
; font-size: 13px; font-style: normal; font-variant: normal; font-weight: 4=
00; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-ri=
ght: 0px; margin-top: 0px; orphans: 2; padding-bottom: 0px; padding-left: 0=
px; 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;">in_place</span><span style=3D=
"background-color: transparent; border-bottom-color: rgb(34, 34, 34); borde=
r-bottom-style: none; border-bottom-width: 0px; border-image-outset: 0; bor=
der-image-repeat: stretch; border-image-slice: 100%; border-image-source: n=
one; 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); display: inline; float: none; font-family: courier new,monospace; fo=
nt-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-decoration: no=
ne; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px;=
white-space: normal; word-spacing: 0px;">_</span><span style=3D"background=
-color: transparent; border-bottom-color: rgb(34, 34, 34); border-bottom-st=
yle: none; border-bottom-width: 0px; border-image-outset: 0; border-image-r=
epeat: stretch; border-image-slice: 100%; border-image-source: none; border=
-image-width: 1; border-left-color: rgb(34, 34, 34); border-left-style: non=
e; border-left-width: 0px; border-right-color: rgb(34, 34, 34); border-righ=
t-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); disp=
lay: inline; float: none; font-family: courier new,monospace; 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;">tag</span></span><span style=3D"display: inl=
ine !important; float: none; background-color: transparent; color: rgb(34, =
34, 34); font-family: courier new,monospace; font-size: 13px; font-style: n=
ormal; font-variant: normal; font-weight: 400; letter-spacing: normal; orph=
ans: 2; 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;"><ValueType>, Args&&... args );</span></font></div=
><div><font face=3D"courier new,monospace"><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;"><br></span></font></div><div><font face=3D"courier new,monospace"><s=
pan style=3D"display: inline !important; float: none; background-color: tra=
nsparent; color: rgb(34, 34, 34); font-family: courier new,monospace; font-=
size: 13px; font-style: normal; font-variant: normal; font-weight: 400; let=
ter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; t=
ext-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; whit=
e-space: normal; word-spacing: 0px;"><br></span></font></div><div><font fac=
e=3D"courier new,monospace"><span style=3D"display: inline !important; floa=
t: 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: none; text-indent: 0px; text-transform: none; -webki=
t-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"><br></sp=
an></font></div><div><span style=3D"text-align: left; color: rgb(34, 34, 34=
); text-transform: none; text-indent: 0px; letter-spacing: normal; font-siz=
e: 13px; font-style: normal; font-variant: normal; font-weight: 400; text-d=
ecoration: none; word-spacing: 0px; display: inline !important; white-space=
: normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; backgrou=
nd-color: transparent;"><font face=3D"arial,sans-serif">Basically we can ha=
ve beautiful and teachable interfaces and the tag stays as implementation d=
etail.</font></span></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/45cdc03c-1370-4ac3-a8ff-334dcc8884b3%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/45cdc03c-1370-4ac3-a8ff-334dcc8884b3=
%40isocpp.org</a>.<br />
------=_Part_63245_458462203.1531130459200--
------=_Part_63244_1662166373.1531130459200--
.
Author: Richard Hodges <hodges.r@gmail.com>
Date: Mon, 9 Jul 2018 12:37:59 +0200
Raw View
--0000000000001f193505708e9c8a
Content-Type: text/plain; charset="UTF-8"
On Mon, 9 Jul 2018 at 12:01, <mihailnajdenov@gmail.com> wrote:
>
> I got an idea this morning, here it is in code
>
>
> void func( width: int val );
> void func( height: int val );
>
Starting to look a lot like objective-c's loathsome syntax.
We can already do:
void func(height val);
void func(width val);
Where
using height = tagged_value<struct height_tag, int>;
template<typename Tag> struct tagged_value { .. implement in terms of
services expressed by the tag... };
Which is IMHO more expressive.
An existing (very complete) model of this:
https://www.boost.org/doc/libs/1_67_0/doc/html/boost_units.html
>
> // compiler generates
>
> // template<auto& name>
> // class func_tag{ };
> //
> // void func( func_tag<"width">, int val );
> // void func( func_tag<"height">, int val );
>
> template<class... Args>
> void ff(Args&&... args)
> {
> func(std::forward<Arsg>(args)...);
> }
>
> int main()
> {
> func(height: 12);
> func(width: 33);
>
> ff(12) //< error: can't convert 12 to width/height
> ff(width: 22); //< works!
>
> return 0;
> }
>
>
> Basically this is a syntax sugar for the tag dispatch idiom.
>
>
> template< class... Args1, class... Args2 >
> pair(piecewise: tuple<Args1...> first_args, tuple<Args2...> second_args);
>
>
> Note, both weak named arguments (transparent to pointers, optional) and
> strong named arguments (overload contribution) have their place!
> This is not a solution for all uses of named arguments, just an
> improvement on already established practice.
>
> Feedback is welcome!
>
>
> P.S. Advanced example
>
> auto a = any(in_place<string>: 3, 'A');
>
>
> template< class ValueType, class... Args >
> explicit any( in_place<ValueType>: Args&&... args );
>
> // Compiler:
>
> // template<auto& name, class T>
> // class typed_tag{ };
> //
> // template<class T>
> // using in_place_tag = typed_tag<"in_place",T>;
> //
> //
> // template< class ValueType, class... Args >
> // explicit any( in_place_tag<ValueType>, Args&&... args );
>
>
>
> Basically we can have beautiful and teachable interfaces and the tag stays
> as implementation detail.
>
> --
> 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/45cdc03c-1370-4ac3-a8ff-334dcc8884b3%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/45cdc03c-1370-4ac3-a8ff-334dcc8884b3%40isocpp.org?utm_medium=email&utm_source=footer>
> .
>
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALvx3hZODTkduJ61OoOofpX21J_-1zAN1rw5PHAmLtg6PmDtvQ%40mail.gmail.com.
--0000000000001f193505708e9c8a
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br><div class=3D"gmail_quote"><div dir=3D"ltr">On Mon=
, 9 Jul 2018 at 12:01, <<a href=3D"mailto:mihailnajdenov@gmail.com">miha=
ilnajdenov@gmail.com</a>> wrote:<br></div><blockquote class=3D"gmail_quo=
te" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204=
);padding-left:1ex"><div dir=3D"ltr"><div><br></div><div>I got an idea this=
morning, here it is in code</div><div><br></div><div><font face=3D"courier=
new,monospace"><br></font></div><div><font face=3D"courier new,monospace">=
void func(=C2=A0 width: int val );<br>void func(=C2=A0 height: int val );</=
font></div></div></blockquote><div><br></div><div>Starting to look a lot li=
ke objective-c's=C2=A0<span style=3D"font-size:small;background-color:r=
gb(255,255,255);text-decoration-style:initial;text-decoration-color:initial=
;float:none;display:inline">loathsome<span>=C2=A0syntax.</span></span></div=
><div><span style=3D"font-size:small;background-color:rgb(255,255,255);text=
-decoration-style:initial;text-decoration-color:initial;float:none;display:=
inline"><span><br></span></span></div><div><span style=3D"font-size:small;b=
ackground-color:rgb(255,255,255);text-decoration-style:initial;text-decorat=
ion-color:initial;float:none;display:inline"><span>We can already do:</span=
></span></div><div><span style=3D"font-size:small;background-color:rgb(255,=
255,255);text-decoration-style:initial;text-decoration-color:initial;float:=
none;display:inline"><span><br></span></span></div><div><div style=3D"font-=
size:small;background-color:rgb(255,255,255);text-decoration-style:initial;=
text-decoration-color:initial"><span style=3D"font-size:small;background-co=
lor:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:in=
itial;float:none;display:inline"><span><font face=3D"monospace, monospace">=
void func(height val);</font></span></span></div><div style=3D"font-size:sm=
all;background-color:rgb(255,255,255);text-decoration-style:initial;text-de=
coration-color:initial"><span style=3D"font-size:small;background-color:rgb=
(255,255,255);text-decoration-style:initial;text-decoration-color:initial;f=
loat:none;display:inline"><span><font face=3D"monospace, monospace">void fu=
nc(width val);</font></span></span></div><div><br></div>Where</div><div><br=
></div><div><font face=3D"monospace, monospace">using height =3D tagged_val=
ue<struct height_tag, int>;</font></div><div><font face=3D"monospace,=
monospace">template<typename Tag> struct <span style=3D"font-size:sm=
all;background-color:rgb(255,255,255);text-decoration-style:initial;text-de=
coration-color:initial;float:none;display:inline">tagged_value { .. impleme=
nt in terms of services expressed by the tag... };</span></font></div><div>=
<br></div><div>=C2=A0Which is IMHO more expressive.</div><div><br></div><di=
v>An existing (very complete) model of this:=C2=A0<a href=3D"https://www.bo=
ost.org/doc/libs/1_67_0/doc/html/boost_units.html">https://www.boost.org/do=
c/libs/1_67_0/doc/html/boost_units.html</a></div><div>=C2=A0</div><blockquo=
te class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px =
solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr"><div><font face=
=3D"courier new,monospace"><br></font></div><div><font face=3D"courier new,=
monospace">// compiler generates</font></div><div><font face=3D"courier new=
,monospace"><br></font></div><div><font face=3D"courier new,monospace">// t=
emplate<auto& name> <br>// class <span style=3D"float:none;backgr=
ound-color:transparent;color:rgb(34,34,34);font-family:"courier new&qu=
ot;,monospace;font-size:13px;font-style:normal;font-variant:normal;font-wei=
ght:400;letter-spacing:normal;text-align:left;text-decoration:none;text-ind=
ent:0px;text-transform:none;white-space:normal;word-spacing:0px;display:inl=
ine">func_</span>tag{ };</font></div><div><font face=3D"courier new,monospa=
ce">//</font></div><div><font face=3D"courier new,monospace">// void func(=
=C2=A0 <span style=3D"float:none;background-color:transparent;color:rgb(34,=
34,34);font-family:"courier new",monospace;font-size:13px;font-st=
yle:normal;font-variant:normal;font-weight:400;letter-spacing:normal;text-a=
lign:left;text-decoration:none;text-indent:0px;text-transform:none;white-sp=
ace:normal;word-spacing:0px;display:inline">func_</span>tag<"width&=
quot;>, int val );<br>// void func(=C2=A0 <span style=3D"float:none;back=
ground-color:transparent;color:rgb(34,34,34);font-family:"courier new&=
quot;,monospace;font-size:13px;font-style:normal;font-variant:normal;font-w=
eight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-i=
ndent:0px;text-transform:none;white-space:normal;word-spacing:0px;display:i=
nline">func_</span>tag<"height">, int val );<br>=C2=A0=C2=
=A0=C2=A0 </font></div><div><font face=3D"courier new,monospace">template&l=
t;class... Args><br>void ff(Args&&... args)<br>{<br>=C2=A0=C2=A0=
=C2=A0 func(std::forward<Arsg>(args)...);<br>}<br>=C2=A0=C2=A0=C2=A0 =
<br>int main()<br>{<br>=C2=A0=C2=A0=C2=A0 func(height: 12);<br>=C2=A0=C2=A0=
=C2=A0 func(width: 33);<br>=C2=A0 <br>=C2=A0=C2=A0=C2=A0 ff(12) //< erro=
r: can't convert 12 to width/height<br>=C2=A0=C2=A0=C2=A0 ff(width: 22)=
; //< works!<br>=C2=A0=C2=A0=C2=A0 <br>=C2=A0=C2=A0=C2=A0 return 0;<br>}=
</font><br></div><div><font face=3D"courier new,monospace"></font><br></div=
><div><br></div><div>Basically this is a syntax sugar for the tag dispatch =
idiom.</div><div><br></div><div><br></div><font face=3D"courier new,monospa=
ce">template< class... Args1, class... Args2 ><br></font><div><font f=
ace=3D"courier new,monospace">pair(piecewise: tuple<Args1...> first_a=
rgs, tuple<Args2...> second_args);</font></div><br><div><font face=3D=
"courier new,monospace"><div></div><div><br></div></font><div><font face=3D=
"arial,sans-serif">Note, both weak<span style=3D"float:none;background-colo=
r:transparent;color:rgb(34,34,34);font-family:arial,sans-serif;font-size:13=
px;font-style:normal;font-variant:normal;font-weight:400;letter-spacing:nor=
mal;text-align:left;text-decoration:none;text-indent:0px;text-transform:non=
e;white-space:normal;word-spacing:0px;display:inline"> named arguments</spa=
n> (transparent to pointers, optional) and strong named arguments (overload=
contribution) have their place!</font></div><div><font face=3D"arial,sans-=
serif">This is not a solution for all uses of named arguments, just an impr=
ovement on already established practice.</font></div><div><font face=3D"ari=
al,sans-serif"><br></font></div><div><font face=3D"arial,sans-serif">Feedba=
ck is welcome!</font></div></div><div><font face=3D"arial,sans-serif"></fon=
t><br></div><div><br></div><div>P.S. Advanced example</div><div><b></b><i><=
/i><u></u><sub></sub><sup></sup><strike></strike><br></div><div><font face=
=3D"courier new,monospace">auto a =3D any(in_place<string>: 3, 'A=
');</font></div><div><font face=3D"courier new,monospace"></font><br></=
div><div><br style=3D"background-clip:border-box;background-color:transpare=
nt;background-image:none;background-origin:padding-box;background-repeat:re=
peat;background-size:auto;border-color:rgb(34,34,34);border-style:none;bord=
er-width:0px;color:rgb(34,34,34);font-family:"courier new",monosp=
ace;font-size:13px;font-style:normal;font-variant:normal;font-weight:400;he=
ight:auto;letter-spacing:normal;margin:0px;min-width:0px;overflow:visible;p=
adding:0px;text-align:left;text-decoration:none;text-indent:0px;text-transf=
orm:none;white-space:normal;word-spacing:0px"><span style=3D"float:none;bac=
kground-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;text-align:left;text-decoration:none;text-=
indent:0px;text-transform:none;white-space:normal;word-spacing:0px;display:=
inline">template< class ValueType, class... Args ></span><br style=3D=
"background-clip:border-box;background-color:transparent;background-image:n=
one;background-origin:padding-box;background-repeat:repeat;background-size:=
auto;border-color:rgb(34,34,34);border-style:none;border-width:0px;color:rg=
b(34,34,34);font-family:"courier new",monospace;font-size:13px;fo=
nt-style:normal;font-variant:normal;font-weight:400;height:auto;letter-spac=
ing:normal;margin:0px;min-width:0px;overflow:visible;padding:0px;text-align=
:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:=
normal;word-spacing:0px"><span style=3D"float:none;background-color:transpa=
rent;color:rgb(34,34,34);font-family:"courier new",monospace;font=
-size:13px;font-style:normal;font-variant:normal;font-weight:400;letter-spa=
cing:normal;text-align:left;text-decoration:none;text-indent:0px;text-trans=
form:none;white-space:normal;word-spacing:0px;display:inline"> </span><span=
style=3D"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;text-align:left;te=
xt-decoration:none;text-indent:0px;text-transform:none;white-space:normal;w=
ord-spacing:0px;display:inline">explicit any( </span><span style=3D"float:n=
one;background-color:transparent;color:rgb(34,34,34);font-family:"cour=
ier new",monospace;font-size:13px;font-style:normal;font-variant:norma=
l;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:non=
e;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;d=
isplay:inline">in_place</span><span style=3D"float:none;background-color:tr=
ansparent;color:rgb(34,34,34);font-family:"courier new",monospace=
;font-size:13px;font-style:normal;font-variant:normal;font-weight:400;lette=
r-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-=
transform:none;white-space:normal;word-spacing:0px;display:inline"><Valu=
eType>: Args&&... args );</span></div><div><b></b><i></i><u></u>=
<sub></sub><sup></sup><strike></strike><br></div><div><font face=3D"courier=
new,monospace">// Compiler:</font></div><div><font face=3D"courier new,mon=
ospace"></font><br></div><div><span style=3D"float:none;background-color:tr=
ansparent;color:rgb(34,34,34);font-family:"courier new",monospace=
;font-size:13px;font-style:normal;font-variant:normal;font-weight:400;lette=
r-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-=
transform:none;white-space:normal;word-spacing:0px;display:inline">// templ=
ate<auto& name, class T> </span><br style=3D"background-clip:bord=
er-box;background-color:transparent;background-image:none;background-origin=
:padding-box;background-repeat:repeat;background-size:auto;border-color:rgb=
(34,34,34);border-style:none;border-width:0px;color:rgb(34,34,34);font-fami=
ly:"courier new",monospace;font-size:13px;font-style:normal;font-=
variant:normal;font-weight:400;height:auto;letter-spacing:normal;margin:0px=
;min-width:0px;overflow:visible;padding:0px;text-align:left;text-decoration=
:none;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0=
px"><font face=3D"courier new,monospace"><span style=3D"text-align:left;col=
or:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:normal;=
font-size:13px;font-style:normal;font-variant:normal;font-weight:400;text-d=
ecoration:none;word-spacing:0px;white-space:normal;float:none;background-co=
lor:transparent;display:inline">// class <span style=3D"text-align:left;col=
or:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:normal;=
font-size:13px;font-style:normal;font-variant:normal;font-weight:400;text-d=
ecoration:none;word-spacing:0px;white-space:normal;float:none;background-co=
lor:transparent;display:inline">typed</span></span><span style=3D"margin:0p=
x;padding:0px;border:0px rgb(34,34,34);text-align:left;color:rgb(34,34,34);=
text-transform:none;text-indent:0px;letter-spacing:normal;font-size:13px;fo=
nt-style:normal;font-variant:normal;font-weight:400;text-decoration:none;wo=
rd-spacing:0px;display:inline;white-space:normal;float:none;background-colo=
r:transparent">_</span><span style=3D"text-align:left;color:rgb(34,34,34);t=
ext-transform:none;text-indent:0px;letter-spacing:normal;font-size:13px;fon=
t-style:normal;font-variant:normal;font-weight:400;text-decoration:none;wor=
d-spacing:0px;white-space:normal;float:none;background-color:transparent;di=
splay:inline">tag{ };</span></font><b></b><i></i><u></u><sub></sub><sup></s=
up><strike></strike></div><div><font face=3D"courier new,monospace">//=C2=
=A0</font></div><div><font face=3D"courier new,monospace">// template<cl=
ass T></font></div><div><font face=3D"courier new,monospace">// using=C2=
=A0<span style=3D"background-color:transparent;border-color:rgb(34,34,34);b=
order-style:none;border-width:0px;color:rgb(34,34,34);display:inline;float:=
none;font-family:"courier new",monospace;font-size:13px;font-styl=
e:normal;font-variant:normal;font-weight:400;letter-spacing:normal;margin:0=
px;padding:0px;text-align:left;text-decoration:none;text-indent:0px;text-tr=
ansform:none;white-space:normal;word-spacing:0px">in_place</span><span styl=
e=3D"background-color:transparent;border-color:rgb(34,34,34);border-style:n=
one;border-width:0px;color:rgb(34,34,34);display:inline;float:none;font-fam=
ily:"courier new",monospace;font-size:13px;font-style:normal;font=
-variant:normal;font-weight:400;letter-spacing:normal;margin:0px;padding:0p=
x;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;=
white-space:normal;word-spacing:0px">_</span><span style=3D"background-colo=
r:transparent;border-color:rgb(34,34,34);border-style:none;border-width:0px=
;color:rgb(34,34,34);display:inline;float:none;font-family:"courier ne=
w",monospace;font-size:13px;font-style:normal;font-variant:normal;font=
-weight:400;letter-spacing:normal;margin:0px;padding:0px;text-align:left;te=
xt-decoration:none;text-indent:0px;text-transform:none;white-space:normal;w=
ord-spacing:0px">tag =3D <span style=3D"background-color:transparent;border=
-color:rgb(34,34,34);border-style:none;border-width:0px;color:rgb(34,34,34)=
;display:inline;float:none;font-family:"courier new",monospace;fo=
nt-size:13px;font-style:normal;font-variant:normal;font-weight:400;letter-s=
pacing:normal;margin:0px;padding:0px;text-align:left;text-decoration:none;t=
ext-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><sp=
an style=3D"background-color:transparent;border-color:rgb(34,34,34);border-=
style:none;border-width:0px;color:rgb(34,34,34);display:inline;float:none;f=
ont-family:"courier new",monospace;font-size:13px;font-style:norm=
al;font-variant:normal;font-weight:400;letter-spacing:normal;margin:0px;pad=
ding:0px;text-align:left;text-decoration:none;text-indent:0px;text-transfor=
m:none;white-space:normal;word-spacing:0px">typed</span></span><span style=
=3D"background-color:transparent;border-color:rgb(34,34,34);border-style:no=
ne;border-width:0px;color:rgb(34,34,34);display:inline;float:none;font-fami=
ly:"courier new",monospace;font-size:13px;font-style:normal;font-=
variant:normal;font-weight:400;letter-spacing:normal;margin:0px;padding:0px=
;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;w=
hite-space:normal;word-spacing:0px"></span><span style=3D"background-color:=
transparent;border-color:rgb(34,34,34);border-style:none;border-width:0px;c=
olor:rgb(34,34,34);display:inline;float:none;font-family:"courier new&=
quot;,monospace;font-size:13px;font-style:normal;font-variant:normal;font-w=
eight:400;letter-spacing:normal;margin:0px;padding:0px;text-align:left;text=
-decoration:none;text-indent:0px;text-transform:none;white-space:normal;wor=
d-spacing:0px">_</span><span style=3D"background-color:transparent;border-c=
olor:rgb(34,34,34);border-style:none;border-width:0px;color:rgb(34,34,34);d=
isplay:inline;float:none;font-family:"courier new",monospace;font=
-size:13px;font-style:normal;font-variant:normal;font-weight:400;letter-spa=
cing:normal;margin:0px;padding:0px;text-align:left;text-decoration:none;tex=
t-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">tag</=
span><"in_place",T>;</span></font></div><div><font face=3D"=
courier new,monospace"><span style=3D"background-color:transparent;border-c=
olor:rgb(34,34,34);border-style:none;border-width:0px;color:rgb(34,34,34);d=
isplay:inline;float:none;font-family:"courier new",monospace;font=
-size:13px;font-style:normal;font-variant:normal;font-weight:400;letter-spa=
cing:normal;margin:0px;padding:0px;text-align:left;text-decoration:none;tex=
t-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">//</s=
pan></font></div><div><font face=3D"courier new,monospace"><span style=3D"b=
ackground-color:transparent;border-color:rgb(34,34,34);border-style:none;bo=
rder-width:0px;color:rgb(34,34,34);display:inline;float:none;font-family:&q=
uot;courier new",monospace;font-size:13px;font-style:normal;font-varia=
nt:normal;font-weight:400;letter-spacing:normal;margin:0px;padding:0px;text=
-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-=
space:normal;word-spacing:0px">//</span></font></div><div><font face=3D"cou=
rier new,monospace"><span style=3D"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;text-align:left;text-decoration:none;text-indent:0px;text-transform:=
none;white-space:normal;word-spacing:0px;display:inline">// template< cl=
ass ValueType, class... Args ></span><br style=3D"background-clip:border=
-box;background-color:transparent;background-image:none;background-origin:p=
adding-box;background-repeat:repeat;background-size:auto;border-color:rgb(3=
4,34,34);border-style:none;border-width:0px;color:rgb(34,34,34);font-family=
:"courier new",monospace;font-size:13px;font-style:normal;font-va=
riant:normal;font-weight:400;height:auto;letter-spacing:normal;margin:0px;m=
in-width:0px;overflow:visible;padding:0px;text-align:left;text-decoration:n=
one;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px=
"><span style=3D"float:none;background-color:transparent;color:rgb(34,34,34=
);font-family:"courier new",monospace;font-size:13px;font-style:n=
ormal;font-variant:normal;font-weight:400;letter-spacing:normal;text-align:=
left;text-decoration:none;text-indent:0px;text-transform:none;white-space:n=
ormal;word-spacing:0px;display:inline"></span><span style=3D"float:none;bac=
kground-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;text-align:left;text-decoration:none;text-=
indent:0px;text-transform:none;white-space:normal;word-spacing:0px;display:=
inline">// explicit any( <span style=3D"background-color:transparent;border=
-color:rgb(34,34,34);border-style:none;border-width:0px;color:rgb(34,34,34)=
;display:inline;float:none;font-family:"courier new",monospace;fo=
nt-size:13px;font-style:normal;font-variant:normal;font-weight:400;letter-s=
pacing:normal;margin:0px;padding:0px;text-align:left;text-decoration:none;t=
ext-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">in_=
place</span><span style=3D"background-color:transparent;border-color:rgb(34=
,34,34);border-style:none;border-width:0px;color:rgb(34,34,34);display:inli=
ne;float:none;font-family:"courier new",monospace;font-size:13px;=
font-style:normal;font-variant:normal;font-weight:400;letter-spacing:normal=
;margin:0px;padding:0px;text-align:left;text-decoration:none;text-indent:0p=
x;text-transform:none;white-space:normal;word-spacing:0px">_</span><span st=
yle=3D"background-color:transparent;border-color:rgb(34,34,34);border-style=
:none;border-width:0px;color:rgb(34,34,34);display:inline;float:none;font-f=
amily:"courier new",monospace;font-size:13px;font-style:normal;fo=
nt-variant:normal;font-weight:400;letter-spacing:normal;margin:0px;padding:=
0px;text-align:left;text-decoration:none;text-indent:0px;text-transform:non=
e;white-space:normal;word-spacing:0px">tag</span></span><span style=3D"floa=
t:none;background-color:transparent;color:rgb(34,34,34);font-family:"c=
ourier new",monospace;font-size:13px;font-style:normal;font-variant:no=
rmal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:=
none;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0p=
x;display:inline"><ValueType>, Args&&... args );</span></font=
></div><div><font face=3D"courier new,monospace"><span style=3D"float:none;=
background-color:transparent;color:rgb(34,34,34);font-family:"courier =
new",monospace;font-size:13px;font-style:normal;font-variant:normal;fo=
nt-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;te=
xt-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;displ=
ay:inline"><br></span></font></div><div><font face=3D"courier new,monospace=
"><span style=3D"float:none;background-color:transparent;color:rgb(34,34,34=
);font-family:"courier new",monospace;font-size:13px;font-style:n=
ormal;font-variant:normal;font-weight:400;letter-spacing:normal;text-align:=
left;text-decoration:none;text-indent:0px;text-transform:none;white-space:n=
ormal;word-spacing:0px;display:inline"><br></span></font></div><div><font f=
ace=3D"courier new,monospace"><span style=3D"float:none;background-color:tr=
ansparent;color:rgb(34,34,34);font-family:"courier new",monospace=
;font-size:13px;font-style:normal;font-variant:normal;font-weight:400;lette=
r-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-=
transform:none;white-space:normal;word-spacing:0px;display:inline"><br></sp=
an></font></div><div><span style=3D"text-align:left;color:rgb(34,34,34);tex=
t-transform:none;text-indent:0px;letter-spacing:normal;font-size:13px;font-=
style:normal;font-variant:normal;font-weight:400;text-decoration:none;word-=
spacing:0px;white-space:normal;float:none;background-color:transparent;disp=
lay:inline"><font face=3D"arial,sans-serif">Basically we can have beautiful=
and teachable interfaces and the tag stays as implementation detail.</font=
></span></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" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/45cdc03c-1370-4ac3-a8ff-334dcc8884b3%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/45cdc03c-1370-=
4ac3-a8ff-334dcc8884b3%40isocpp.org</a>.<br>
</blockquote></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/CALvx3hZODTkduJ61OoOofpX21J_-1zAN1rw5=
PHAmLtg6PmDtvQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALvx3hZODTkduJ61=
OoOofpX21J_-1zAN1rw5PHAmLtg6PmDtvQ%40mail.gmail.com</a>.<br />
--0000000000001f193505708e9c8a--
.
Author: mihailnajdenov@gmail.com
Date: Mon, 9 Jul 2018 05:03:18 -0700 (PDT)
Raw View
------=_Part_70465_1988031285.1531137799061
Content-Type: multipart/alternative;
boundary="----=_Part_70466_1860314984.1531137799061"
------=_Part_70466_1860314984.1531137799061
Content-Type: text/plain; charset="UTF-8"
On Monday, July 9, 2018 at 1:38:12 PM UTC+3, Richard Hodges wrote:
>
>
>
> On Mon, 9 Jul 2018 at 12:01, <mihailn...@gmail.com <javascript:>> wrote:
>
>>
>> I got an idea this morning, here it is in code
>>
>>
>> void func( width: int val );
>> void func( height: int val );
>>
>
> Starting to look a lot like objective-c's loathsome syntax.
>
> We can already do:
>
> void func(height val);
> void func(width val);
>
> Where
>
> using height = tagged_value<struct height_tag, int>;
> template<typename Tag> struct tagged_value { .. implement in terms of
> services expressed by the tag... };
>
> Which is IMHO more expressive.
>
> An existing (very complete) model of this:
> https://www.boost.org/doc/libs/1_67_0/doc/html/boost_units.html
>
This can't handle nearly enough cases and is much more intrusive to the
function - val is now a different type, this leaks into the implementation
as well
Also consider
Rect(center: Point c, Size size);
Rect(topLeft: Point tl, Size size);
Rect(bottomLeft: Point bl, Size size);
Semantically some BottomLeftPointType is just wrong
In general very often we want *both* the old types and the old function
name, but to have a different implementation (to do something different).
This is why tags are so great and this suggestion is just an extension of
that, the same way structured binding are syntax sugar for the returned
struct.
More real word examples (slightly modified)
QImage(serializedData: const uchar *data, int size, const char *format =
{});
QByteArray(base64: const QByteArray& val);
QByteArray(percentEncoded: const QByteArray& val, char percent = '%')
QByteArray(parseNumber: int val);
QByteArray(parseNumber: double val);
Note the last two in particular - special type will be *completely*
redundant - parseDoubleNumber{5} or something like that.
--
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/da3e4418-e043-4ad4-bab4-513ddd633abe%40isocpp.org.
------=_Part_70466_1860314984.1531137799061
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Monday, July 9, 2018 at 1:38:12 PM UTC+3, Richa=
rd Hodges 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"lt=
r"><br><br><div class=3D"gmail_quote"><div dir=3D"ltr">On Mon, 9 Jul 2018 a=
t 12:01, <<a onmousedown=3D"this.href=3D'javascript:';return tru=
e;" onclick=3D"this.href=3D'javascript:';return true;" href=3D"java=
script:" target=3D"_blank" rel=3D"nofollow" gdf-obfuscated-mailto=3D"tb-pNg=
LABQAJ">mihailn...@gmail.com</a>> wrote:<br></div><blockquote class=3D"g=
mail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204=
,204,204);padding-left:1ex"><div dir=3D"ltr"><div><br></div><div>I got an i=
dea this morning, here it is in code</div><div><br></div><div><font face=3D=
"courier new,monospace"><br></font></div><div><font face=3D"courier new,mon=
ospace">void func(=C2=A0 width: int val );<br>void func(=C2=A0 height: int =
val );</font></div></div></blockquote><div><br></div><div>Starting to look =
a lot like objective-c's=C2=A0<span style=3D"font-size:small;background=
-color:rgb(255,255,255);float:none;display:inline">loathsome<span>=C2=A0<wb=
r>syntax.</span></span></div><div><span style=3D"font-size:small;background=
-color:rgb(255,255,255);float:none;display:inline"><span><br></span></span>=
</div><div><span style=3D"font-size:small;background-color:rgb(255,255,255)=
;float:none;display:inline"><span>We can already do:</span></span></div><di=
v><span style=3D"font-size:small;background-color:rgb(255,255,255);float:no=
ne;display:inline"><span><br></span></span></div><div><div style=3D"font-si=
ze:small;background-color:rgb(255,255,255)"><span style=3D"font-size:small;=
background-color:rgb(255,255,255);float:none;display:inline"><span><font fa=
ce=3D"monospace, monospace">void func(height val);</font></span></span></di=
v><div style=3D"font-size:small;background-color:rgb(255,255,255)"><span st=
yle=3D"font-size:small;background-color:rgb(255,255,255);float:none;display=
:inline"><span><font face=3D"monospace, monospace">void func(width val);</f=
ont></span></span></div><div><br></div>Where</div><div><br></div><div><font=
face=3D"monospace, monospace">using height =3D tagged_value<struct heig=
ht_tag, int>;</font></div><div><font face=3D"monospace, monospace">templ=
ate<typename Tag> struct <span style=3D"font-size:small;background-co=
lor:rgb(255,255,255);float:none;display:inline">tagged_value { .. implement=
in terms of services expressed by the tag... };</span></font></div><div><b=
r></div><div>=C2=A0Which is IMHO more expressive.</div><div><br></div><div>=
An existing (very complete) model of this:=C2=A0<a onmousedown=3D"this.href=
=3D'https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.boost.org%2Fdoc%2=
Flibs%2F1_67_0%2Fdoc%2Fhtml%2Fboost_units.html\x26sa\x3dD\x26sntz\x3d1\x26u=
sg\x3dAFQjCNHfsIv8WL2pPVFxDMmIoV22x7Nsog';return true;" onclick=3D"this=
..href=3D'https://www.google.com/url?q\x3dhttps%3A%2F%2Fwww.boost.org%2F=
doc%2Flibs%2F1_67_0%2Fdoc%2Fhtml%2Fboost_units.html\x26sa\x3dD\x26sntz\x3d1=
\x26usg\x3dAFQjCNHfsIv8WL2pPVFxDMmIoV22x7Nsog';return true;" href=3D"ht=
tps://www.boost.org/doc/libs/1_67_0/doc/html/boost_units.html" target=3D"_b=
lank" rel=3D"nofollow">https://www.boost.org/<wbr>doc/libs/1_67_0/doc/html/=
<wbr>boost_units.html</a></div></div></div></blockquote><div><br></div><div=
>This can't handle nearly enough cases and is much more intrusive to th=
e function - val is now a different type, this leaks into the implementatio=
n as well</div><div><br></div><div>Also consider=C2=A0<br></div><div><font =
face=3D"courier new,monospace"><span style=3D"display: inline !important; f=
loat: none; background-color: transparent; color: rgb(34, 34, 34); font-fam=
ily: courier new,monospace; font-size: 13px; font-style: normal; font-varia=
nt: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-alig=
n: left; text-decoration: none; text-indent: 0px; text-transform: none; -we=
bkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">Rect(=
center: Point c, Size size);</span></font></div><div><font face=3D"courier =
new,monospace"><span style=3D"display: inline !important; float: none; back=
ground-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-de=
coration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke=
-width: 0px; white-space: normal; word-spacing: 0px;">Rect(topLeft: Point t=
l, Size size);</span><b></b><i></i><u></u><sub></sub><sup></sup><strike></s=
trike><br></font></div><div><font face=3D"courier new,monospace"><span styl=
e=3D"background-color: transparent; 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; color: rgb(34=
, 34, 34); display: inline; float: none; font-family: courier new,monospace=
; font-size: 13px; font-style: normal; font-variant: normal; font-weight: 4=
00; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; margin-ri=
ght: 0px; margin-top: 0px; orphans: 2; padding-bottom: 0px; padding-left: 0=
px; 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;">Rect(bottomLeft: Point bl, Si=
ze size);</span></font></div><div><font face=3D"courier new,monospace"><spa=
n 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); display: inline; float: none; font-family: courier new,mon=
ospace; font-size: 13px; font-style: normal; font-variant: normal; font-wei=
ght: 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; mar=
gin-right: 0px; margin-top: 0px; orphans: 2; padding-bottom: 0px; padding-l=
eft: 0px; padding-right: 0px; padding-top: 0px; text-align: left; text-deco=
ration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-w=
idth: 0px; white-space: normal; word-spacing: 0px;"><br></span></font></div=
><div><span style=3D"margin: 0px; padding: 0px; border: 0px rgb(34, 34, 34)=
; border-image: none; text-align: left; color: rgb(34, 34, 34); text-transf=
orm: none; text-indent: 0px; letter-spacing: normal; font-size: 13px; font-=
style: normal; font-variant: normal; font-weight: 400; text-decoration: non=
e; word-spacing: 0px; display: inline; white-space: normal; orphans: 2; flo=
at: none; -webkit-text-stroke-width: 0px; background-color: transparent;"><=
font face=3D"arial,sans-serif">Semantically some BottomLeftPointType is jus=
t wrong</font></span></div><div><span style=3D"margin: 0px; padding: 0px; b=
order: 0px rgb(34, 34, 34); border-image: none; text-align: left; color: rg=
b(34, 34, 34); text-transform: none; text-indent: 0px; letter-spacing: norm=
al; font-size: 13px; font-style: normal; font-variant: normal; font-weight:=
400; text-decoration: none; word-spacing: 0px; display: inline; white-spac=
e: normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; backgro=
und-color: transparent;"><font face=3D"arial,sans-serif"><br></font></span>=
</div><div><span style=3D"margin: 0px; padding: 0px; border: 0px rgb(34, 34=
, 34); border-image: none; text-align: left; color: rgb(34, 34, 34); text-t=
ransform: none; text-indent: 0px; letter-spacing: normal; font-size: 13px; =
font-style: normal; font-variant: normal; font-weight: 400; text-decoration=
: none; word-spacing: 0px; display: inline; white-space: normal; orphans: 2=
; float: none; -webkit-text-stroke-width: 0px; background-color: transparen=
t;"><font face=3D"arial,sans-serif"><br></font></span></div><div><span styl=
e=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-size: 13px; font-style: normal; f=
ont-variant: normal; font-weight: 400; text-decoration: none; word-spacing:=
0px; display: inline; white-space: normal; orphans: 2; float: none; -webki=
t-text-stroke-width: 0px; background-color: transparent;"><font face=3D"ari=
al,sans-serif">In general very often we want <i>both</i> the old types and =
the old function name, but to have a different implementation (to do someth=
ing different).=C2=A0</font></span></div><div><span style=3D"margin: 0px; p=
adding: 0px; border: 0px rgb(34, 34, 34); border-image: none; text-align: l=
eft; color: rgb(34, 34, 34); text-transform: none; text-indent: 0px; letter=
-spacing: normal; font-size: 13px; font-style: normal; font-variant: normal=
; font-weight: 400; text-decoration: none; word-spacing: 0px; display: inli=
ne; white-space: normal; orphans: 2; float: none; -webkit-text-stroke-width=
: 0px; background-color: transparent;"><font face=3D"arial,sans-serif"><br>=
</font></span></div><div><span style=3D"margin: 0px; padding: 0px; border: =
0px rgb(34, 34, 34); border-image: none; text-align: left; color: rgb(34, 3=
4, 34); text-transform: none; text-indent: 0px; letter-spacing: normal; fon=
t-size: 13px; font-style: normal; font-variant: normal; font-weight: 400; t=
ext-decoration: none; word-spacing: 0px; display: inline; white-space: norm=
al; orphans: 2; float: none; -webkit-text-stroke-width: 0px; background-col=
or: transparent;"><font face=3D"arial,sans-serif">This is why tags are so g=
reat and this suggestion is just an extension of that, the same way structu=
red binding are syntax sugar for the returned struct.</font></span></div><d=
iv><span style=3D"margin: 0px; padding: 0px; border: 0px rgb(34, 34, 34); b=
order-image: none; text-align: left; color: rgb(34, 34, 34); text-transform=
: none; text-indent: 0px; letter-spacing: normal; font-size: 13px; font-sty=
le: normal; font-variant: normal; font-weight: 400; text-decoration: none; =
word-spacing: 0px; display: inline; white-space: normal; orphans: 2; float:=
none; -webkit-text-stroke-width: 0px; background-color: transparent;"><fon=
t face=3D"arial,sans-serif"><br></font></span></div><div><span style=3D"mar=
gin: 0px; padding: 0px; border: 0px rgb(34, 34, 34); border-image: none; te=
xt-align: left; color: rgb(34, 34, 34); text-transform: none; text-indent: =
0px; letter-spacing: normal; font-size: 13px; font-style: normal; font-vari=
ant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; di=
splay: inline; white-space: normal; orphans: 2; float: none; -webkit-text-s=
troke-width: 0px; background-color: transparent;"><font face=3D"arial,sans-=
serif"><br></font></span></div><div><span style=3D"margin: 0px; padding: 0p=
x; 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-size: 13px; font-style: normal; font-variant: normal; font-wei=
ght: 400; text-decoration: none; word-spacing: 0px; display: inline; white-=
space: normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; bac=
kground-color: transparent;"><font face=3D"arial,sans-serif">More real word=
examples (slightly modified)</font></span></div><font face=3D"courier new,=
monospace"><br>QImage(serializedData: const uchar *data, int size, const ch=
ar *format =3D {}); <br><br>QByteArray(base64: const QByteArray& val);<=
br>QByteArray(percentEncoded: const QByteArray& val, char percent =3D &=
#39;%')<br><br>QByteArray(parseNumber: int val);=C2=A0<br>QByteArray(<s=
pan style=3D"display: inline !important; float: none; background-color: tra=
nsparent; color: rgb(34, 34, 34); font-family: courier new,monospace; font-=
size: 13px; font-style: normal; font-variant: normal; font-weight: 400; let=
ter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; t=
ext-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; whit=
e-space: normal; word-spacing: 0px;">parseNumber</span>: double val);</font=
><div></div><div><b></b><i></i><u></u><sub></sub><sup></sup><strike></strik=
e><font face=3D"courier new,monospace"></font><br></div><div>Note the last =
two in particular - special type will be=C2=A0 <i>completely</i> redundant =
- parseDoubleNumber{5} or something like that.</div><div><br></div><div><br=
></div><div><font face=3D"courier new,monospace"><b></b><i></i><u></u><sub>=
</sub><sup></sup><strike></strike><b></b><i></i><u></u><sub></sub><sup></su=
p><strike></strike><b></b><i></i><u></u><sub></sub><sup></sup><strike></str=
ike><br></font></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/da3e4418-e043-4ad4-bab4-513ddd633abe%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/da3e4418-e043-4ad4-bab4-513ddd633abe=
%40isocpp.org</a>.<br />
------=_Part_70466_1860314984.1531137799061--
------=_Part_70465_1988031285.1531137799061--
.
Author: Dejan Milosavljevic <dmilos@gmail.com>
Date: Mon, 9 Jul 2018 14:18:45 +0200
Raw View
--000000000000d729e60570900303
Content-Type: text/plain; charset="UTF-8"
Appears as strong typedef applied only on parameters..
On Mon, Jul 9, 2018 at 2:03 PM, <mihailnajdenov@gmail.com> wrote:
>
>
> On Monday, July 9, 2018 at 1:38:12 PM UTC+3, Richard Hodges wrote:
>>
>>
>>
>> On Mon, 9 Jul 2018 at 12:01, <mihailn...@gmail.com> wrote:
>>
>>>
>>> I got an idea this morning, here it is in code
>>>
>>>
>>> void func( width: int val );
>>> void func( height: int val );
>>>
>>
>> Starting to look a lot like objective-c's loathsome syntax.
>>
>> We can already do:
>>
>> void func(height val);
>> void func(width val);
>>
>> Where
>>
>> using height = tagged_value<struct height_tag, int>;
>> template<typename Tag> struct tagged_value { .. implement in terms of
>> services expressed by the tag... };
>>
>> Which is IMHO more expressive.
>>
>> An existing (very complete) model of this: https://www.boost.org/do
>> c/libs/1_67_0/doc/html/boost_units.html
>>
>
> This can't handle nearly enough cases and is much more intrusive to the
> function - val is now a different type, this leaks into the implementation
> as well
>
> Also consider
> Rect(center: Point c, Size size);
> Rect(topLeft: Point tl, Size size);
> Rect(bottomLeft: Point bl, Size size);
>
> Semantically some BottomLeftPointType is just wrong
>
>
> In general very often we want *both* the old types and the old function
> name, but to have a different implementation (to do something different).
>
> This is why tags are so great and this suggestion is just an extension of
> that, the same way structured binding are syntax sugar for the returned
> struct.
>
>
> More real word examples (slightly modified)
>
> QImage(serializedData: const uchar *data, int size, const char *format =
> {});
>
> QByteArray(base64: const QByteArray& val);
> QByteArray(percentEncoded: const QByteArray& val, char percent = '%')
>
> QByteArray(parseNumber: int val);
> QByteArray(parseNumber: double val);
>
> Note the last two in particular - special type will be *completely*
> redundant - parseDoubleNumber{5} or something like that.
>
>
>
> --
> 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/da3e4418-e043-4ad4-
> bab4-513ddd633abe%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/da3e4418-e043-4ad4-bab4-513ddd633abe%40isocpp.org?utm_medium=email&utm_source=footer>
> .
>
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAEfefmwgxHQFzQokjABgJhyh6t-h1LBb441%3DT9V-p7qVUw5dNA%40mail.gmail.com.
--000000000000d729e60570900303
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Appears as strong typedef applied only on parameters..</di=
v><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">On Mon, Jul 9, =
2018 at 2:03 PM, <span dir=3D"ltr"><<a href=3D"mailto:mihailnajdenov@gm=
ail.com" target=3D"_blank">mihailnajdenov@gmail.com</a>></span> wrote:<b=
r><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:=
1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><br><br>On Monday, July 9=
, 2018 at 1:38:12 PM UTC+3, Richard Hodges wrote:<blockquote class=3D"gmail=
_quote" style=3D"margin:0px 0px 0px 0.8ex;padding-left:1ex;border-left-colo=
r:rgb(204,204,204);border-left-width:1px;border-left-style:solid"><div dir=
=3D"ltr"><br><br><div class=3D"gmail_quote"><div dir=3D"ltr">On Mon, 9 Jul =
2018 at 12:01, <<a rel=3D"nofollow">mihailn...@gmail.com</a>> wrote:<=
br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8e=
x;padding-left:1ex;border-left-color:rgb(204,204,204);border-left-width:1px=
;border-left-style:solid"><div dir=3D"ltr"><div><br></div><div>I got an ide=
a this morning, here it is in code</div><div><br></div><div><font face=3D"c=
ourier new,monospace"><br></font></div><div><font face=3D"courier new,monos=
pace">void func(=C2=A0 width: int val );<br>void func(=C2=A0 height: int va=
l );</font></div></div></blockquote><div><br></div><div>Starting to look a =
lot like objective-c's=C2=A0<span style=3D"font-size:small;float:none;d=
isplay:inline;background-color:rgb(255,255,255)">loathsome<span>=C2=A0synta=
x<wbr>.</span></span></div><div><span style=3D"font-size:small;float:none;d=
isplay:inline;background-color:rgb(255,255,255)"><span><br></span></span></=
div><div><span style=3D"font-size:small;float:none;display:inline;backgroun=
d-color:rgb(255,255,255)"><span>We can already do:</span></span></div><div>=
<span style=3D"font-size:small;float:none;display:inline;background-color:r=
gb(255,255,255)"><span><br></span></span></div><div><div style=3D"font-size=
:small;background-color:rgb(255,255,255)"><span style=3D"font-size:small;fl=
oat:none;display:inline;background-color:rgb(255,255,255)"><span><font face=
=3D"monospace, monospace">void func(height val);</font></span></span></div>=
<div style=3D"font-size:small;background-color:rgb(255,255,255)"><span styl=
e=3D"font-size:small;float:none;display:inline;background-color:rgb(255,255=
,255)"><span><font face=3D"monospace, monospace">void func(width val);</fon=
t></span></span></div><div><br></div>Where</div><div><br></div><div><font f=
ace=3D"monospace, monospace">using height =3D tagged_value<struct height=
_tag, int>;</font></div><div><font face=3D"monospace, monospace">templat=
e<typename Tag> struct <span style=3D"font-size:small;float:none;disp=
lay:inline;background-color:rgb(255,255,255)">tagged_value { .. implement i=
n terms of services expressed by the tag... };</span></font></div><div><br>=
</div><div>=C2=A0Which is IMHO more expressive.</div><div><br></div><div>An=
existing (very complete) model of this:=C2=A0<a href=3D"https://www.boost.=
org/doc/libs/1_67_0/doc/html/boost_units.html" target=3D"_blank" rel=3D"nof=
ollow">https://www.boost.org/do<wbr>c/libs/1_67_0/doc/html/boost_<wbr>units=
..html</a></div></div></div></blockquote><div><br></div><div>This can't =
handle nearly enough cases and is much more intrusive to the function - val=
is now a different type, this leaks into the implementation as well</div><=
div><br></div><div>Also consider=C2=A0<br></div><div><font face=3D"courier =
new,monospace"><span style=3D"text-align:left;color:rgb(34,34,34);text-tran=
sform:none;text-indent:0px;letter-spacing:normal;font-family:courier new,mo=
nospace;font-size:13px;font-style:normal;font-variant:normal;font-weight:40=
0;text-decoration:none;word-spacing:0px;float:none;display:inline!important=
;white-space:normal;background-color:transparent">Rect(center: Point c, Siz=
e size);</span></font></div><div><font face=3D"courier new,monospace"><span=
style=3D"text-align:left;color:rgb(34,34,34);text-transform:none;text-inde=
nt:0px;letter-spacing:normal;font-family:courier new,monospace;font-size:13=
px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:no=
ne;word-spacing:0px;float:none;display:inline!important;white-space:normal;=
background-color:transparent">Rect(topLeft: Point tl, Size size);</span><b>=
</b><i></i><u></u><sub></sub><sup></sup><strike></strike><br></font></div><=
div><font face=3D"courier new,monospace"><span style=3D"margin:0px;padding:=
0px;border:0px rgb(34,34,34);text-align:left;color:rgb(34,34,34);text-trans=
form:none;text-indent:0px;letter-spacing:normal;font-family:courier new,mon=
ospace;font-size:13px;font-style:normal;font-variant:normal;font-weight:400=
;text-decoration:none;word-spacing:0px;float:none;display:inline;white-spac=
e:normal;background-color:transparent">Rect(bottomLeft: Point bl, Size size=
);</span></font></div><div><font face=3D"courier new,monospace"><span style=
=3D"margin:0px;padding:0px;border:0px rgb(34,34,34);text-align:left;color:r=
gb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:normal;font=
-family:courier new,monospace;font-size:13px;font-style:normal;font-variant=
:normal;font-weight:400;text-decoration:none;word-spacing:0px;float:none;di=
splay:inline;white-space:normal;background-color:transparent"><br></span></=
font></div><div><span style=3D"margin:0px;padding:0px;border:0px rgb(34,34,=
34);text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0px=
;letter-spacing:normal;font-size:13px;font-style:normal;font-variant:normal=
;font-weight:400;text-decoration:none;word-spacing:0px;float:none;display:i=
nline;white-space:normal;background-color:transparent"><font face=3D"arial,=
sans-serif">Semantically some BottomLeftPointType is just wrong</font></spa=
n></div><div><span style=3D"margin:0px;padding:0px;border:0px rgb(34,34,34)=
;text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0px;le=
tter-spacing:normal;font-size:13px;font-style:normal;font-variant:normal;fo=
nt-weight:400;text-decoration:none;word-spacing:0px;float:none;display:inli=
ne;white-space:normal;background-color:transparent"><font face=3D"arial,san=
s-serif"><br></font></span></div><div><span style=3D"margin:0px;padding:0px=
;border:0px rgb(34,34,34);text-align:left;color:rgb(34,34,34);text-transfor=
m:none;text-indent:0px;letter-spacing:normal;font-size:13px;font-style:norm=
al;font-variant:normal;font-weight:400;text-decoration:none;word-spacing:0p=
x;float:none;display:inline;white-space:normal;background-color:transparent=
"><font face=3D"arial,sans-serif"><br></font></span></div><div><span style=
=3D"margin:0px;padding:0px;border:0px rgb(34,34,34);text-align:left;color:r=
gb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:normal;font=
-size:13px;font-style:normal;font-variant:normal;font-weight:400;text-decor=
ation:none;word-spacing:0px;float:none;display:inline;white-space:normal;ba=
ckground-color:transparent"><font face=3D"arial,sans-serif">In general very=
often we want <i>both</i> the old types and the old function name, but to =
have a different implementation (to do something different).=C2=A0</font></=
span></div><div><span style=3D"margin:0px;padding:0px;border:0px rgb(34,34,=
34);text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0px=
;letter-spacing:normal;font-size:13px;font-style:normal;font-variant:normal=
;font-weight:400;text-decoration:none;word-spacing:0px;float:none;display:i=
nline;white-space:normal;background-color:transparent"><font face=3D"arial,=
sans-serif"><br></font></span></div><div><span style=3D"margin:0px;padding:=
0px;border:0px rgb(34,34,34);text-align:left;color:rgb(34,34,34);text-trans=
form:none;text-indent:0px;letter-spacing:normal;font-size:13px;font-style:n=
ormal;font-variant:normal;font-weight:400;text-decoration:none;word-spacing=
:0px;float:none;display:inline;white-space:normal;background-color:transpar=
ent"><font face=3D"arial,sans-serif">This is why tags are so great and this=
suggestion is just an extension of that, the same way structured binding a=
re syntax sugar for the returned struct.</font></span></div><div><span styl=
e=3D"margin:0px;padding:0px;border:0px rgb(34,34,34);text-align:left;color:=
rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:normal;fon=
t-size:13px;font-style:normal;font-variant:normal;font-weight:400;text-deco=
ration:none;word-spacing:0px;float:none;display:inline;white-space:normal;b=
ackground-color:transparent"><font face=3D"arial,sans-serif"><br></font></s=
pan></div><div><span style=3D"margin:0px;padding:0px;border:0px rgb(34,34,3=
4);text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0px;=
letter-spacing:normal;font-size:13px;font-style:normal;font-variant:normal;=
font-weight:400;text-decoration:none;word-spacing:0px;float:none;display:in=
line;white-space:normal;background-color:transparent"><font face=3D"arial,s=
ans-serif"><br></font></span></div><div><span style=3D"margin:0px;padding:0=
px;border:0px rgb(34,34,34);text-align:left;color:rgb(34,34,34);text-transf=
orm:none;text-indent:0px;letter-spacing:normal;font-size:13px;font-style:no=
rmal;font-variant:normal;font-weight:400;text-decoration:none;word-spacing:=
0px;float:none;display:inline;white-space:normal;background-color:transpare=
nt"><font face=3D"arial,sans-serif">More real word examples (slightly modif=
ied)</font></span></div><font face=3D"courier new,monospace"><br>QImage(ser=
ializedData: const uchar *data, int size, const char *format =3D {}); <br><=
br>QByteArray(base64: const QByteArray& val);<br>QByteArray(percentEnco=
ded: const QByteArray& val, char percent =3D '%')<br><br>QByteA=
rray(parseNumber: int val);=C2=A0<br>QByteArray(<span style=3D"text-align:l=
eft;color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:=
normal;font-family:courier new,monospace;font-size:13px;font-style:normal;f=
ont-variant:normal;font-weight:400;text-decoration:none;word-spacing:0px;fl=
oat:none;display:inline!important;white-space:normal;background-color:trans=
parent">parseNumber</span>: double val);</font><div></div><div><b></b><i></=
i><u></u><sub></sub><sup></sup><strike></strike><font face=3D"courier new,m=
onospace"></font><br></div><div>Note the last two in particular - special t=
ype will be=C2=A0 <i>completely</i> redundant - parseDoubleNumber{5} or som=
ething like that.</div><span class=3D"HOEnZb"><font color=3D"#888888"><div>=
<br></div><div><br></div><div><font face=3D"courier new,monospace"><b></b><=
i></i><u></u><sub></sub><sup></sup><strike></strike><b></b><i></i><u></u><s=
ub></sub><sup></sup><strike></strike><b></b><i></i><u></u><sub></sub><sup><=
/sup><strike></strike><br></font></div></font></span></div><span class=3D"H=
OEnZb"><font color=3D"#888888">
<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" target=3D"_=
blank">std-proposals+unsubscribe@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/da3e4418-e043-4ad4-bab4-513ddd633abe%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/da3e=
4418-e043-4ad4-<wbr>bab4-513ddd633abe%40isocpp.org</a><wbr>.<br>
</font></span></blockquote></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/CAEfefmwgxHQFzQokjABgJhyh6t-h1LBb441%=
3DT9V-p7qVUw5dNA%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAEfefmwgxHQFzQ=
okjABgJhyh6t-h1LBb441%3DT9V-p7qVUw5dNA%40mail.gmail.com</a>.<br />
--000000000000d729e60570900303--
.
Author: Richard Hodges <hodges.r@gmail.com>
Date: Mon, 9 Jul 2018 15:03:21 +0200
Raw View
--00000000000008e990057090a43b
Content-Type: text/plain; charset="UTF-8"
On Mon, 9 Jul 2018 at 14:03, <mihailnajdenov@gmail.com> wrote:
>
>
> On Monday, July 9, 2018 at 1:38:12 PM UTC+3, Richard Hodges wrote:
>>
>>
>>
>> On Mon, 9 Jul 2018 at 12:01, <mihailn...@gmail.com> wrote:
>>
>>>
>>> I got an idea this morning, here it is in code
>>>
>>>
>>> void func( width: int val );
>>> void func( height: int val );
>>>
>>
>> Starting to look a lot like objective-c's loathsome syntax.
>>
>> We can already do:
>>
>> void func(height val);
>> void func(width val);
>>
>> Where
>>
>> using height = tagged_value<struct height_tag, int>;
>> template<typename Tag> struct tagged_value { .. implement in terms of
>> services expressed by the tag... };
>>
>> Which is IMHO more expressive.
>>
>> An existing (very complete) model of this:
>> https://www.boost.org/doc/libs/1_67_0/doc/html/boost_units.html
>>
>
> This can't handle nearly enough cases and is much more intrusive to the
> function - val is now a different type, this leaks into the implementation
> as well
>
Different semantic meaning == different type is a *good thing* as it allows
relationships and operations to be checked at compile time. That means
fewer bugs.
>
> Also consider
> Rect(center: Point c, Size size);
> Rect(topLeft: Point tl, Size size);
> Rect(bottomLeft: Point bl, Size size);
>
> Semantically some BottomLeftPointType is just wrong
>
It's only wrong if the behaviour of a bottom-left point is different to the
behaviour of a top-left point. If it's not, then why bother tagging?
>
>
> In general very often we want *both* the old types and the old function
> name, but to have a different implementation (to do something different).
>
> This is why tags are so great and this suggestion is just an extension of
> that, the same way structured binding are syntax sugar for the returned
> struct.
>
>
> More real word examples (slightly modified)
>
> QImage(serializedData: const uchar *data, int size, const char *format =
> {});
>
QImage(ByteBuffer const&, FormatString const&); // semantically
meaningful, 1 fewer arguments, fewer errors
> QByteArray(base64: const QByteArray& val);
> QByteArray(percentEncoded: const QByteArray& val, char percent = '%')
>
> QByteArray(parseNumber: int val);
> QByteArray(parseNumber: double val);
>
> Note the last two in particular - special type will be *completely*
> redundant - parseDoubleNumber{5} or something like that.
>
template<class Numeric> struct parse_number { ... };
QByteArray(parse_number(5)); //c++17 template type deduction yields
parse_number<int>
QByteArray(parse_number(5.0)); //c++17 template type deduction yields
parse_number<double>
There was a great CppCon talk on this. It's worth seeking out.
>
>
>
> --
> 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/da3e4418-e043-4ad4-bab4-513ddd633abe%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/da3e4418-e043-4ad4-bab4-513ddd633abe%40isocpp.org?utm_medium=email&utm_source=footer>
> .
>
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALvx3hbKvCUMGE5cr60Zu90Fia-ngcuwg2j%2B0zRTBSNzqupimA%40mail.gmail.com.
--00000000000008e990057090a43b
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br><div class=3D"gmail_quote"><div dir=3D"ltr">On Mon=
, 9 Jul 2018 at 14:03, <<a href=3D"mailto:mihailnajdenov@gmail.com">miha=
ilnajdenov@gmail.com</a>> wrote:<br></div><blockquote class=3D"gmail_quo=
te" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"=
><div dir=3D"ltr"><br><br>On Monday, July 9, 2018 at 1:38:12 PM UTC+3, Rich=
ard Hodges 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"><=
br><br><div class=3D"gmail_quote"><div dir=3D"ltr">On Mon, 9 Jul 2018 at 12=
:01, <<a rel=3D"nofollow">mihailn...@gmail.com</a>> wrote:<br></div><=
blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-l=
eft:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr"><div><br>=
</div><div>I got an idea this morning, here it is in code</div><div><br></d=
iv><div><font face=3D"courier new,monospace"><br></font></div><div><font fa=
ce=3D"courier new,monospace">void func(=C2=A0 width: int val );<br>void fun=
c(=C2=A0 height: int val );</font></div></div></blockquote><div><br></div><=
div>Starting to look a lot like objective-c's=C2=A0<span style=3D"font-=
size:small;background-color:rgb(255,255,255);float:none;display:inline">loa=
thsome<span>=C2=A0syntax.</span></span></div><div><span style=3D"font-size:=
small;background-color:rgb(255,255,255);float:none;display:inline"><span><b=
r></span></span></div><div><span style=3D"font-size:small;background-color:=
rgb(255,255,255);float:none;display:inline"><span>We can already do:</span>=
</span></div><div><span style=3D"font-size:small;background-color:rgb(255,2=
55,255);float:none;display:inline"><span><br></span></span></div><div><div =
style=3D"font-size:small;background-color:rgb(255,255,255)"><span style=3D"=
font-size:small;background-color:rgb(255,255,255);float:none;display:inline=
"><span><font face=3D"monospace, monospace">void func(height val);</font></=
span></span></div><div style=3D"font-size:small;background-color:rgb(255,25=
5,255)"><span style=3D"font-size:small;background-color:rgb(255,255,255);fl=
oat:none;display:inline"><span><font face=3D"monospace, monospace">void fun=
c(width val);</font></span></span></div><div><br></div>Where</div><div><br>=
</div><div><font face=3D"monospace, monospace">using height =3D tagged_valu=
e<struct height_tag, int>;</font></div><div><font face=3D"monospace, =
monospace">template<typename Tag> struct <span style=3D"font-size:sma=
ll;background-color:rgb(255,255,255);float:none;display:inline">tagged_valu=
e { .. implement in terms of services expressed by the tag... };</span></fo=
nt></div><div><br></div><div>=C2=A0Which is IMHO more expressive.</div><div=
><br></div><div>An existing (very complete) model of this:=C2=A0<a href=3D"=
https://www.boost.org/doc/libs/1_67_0/doc/html/boost_units.html" rel=3D"nof=
ollow" target=3D"_blank">https://www.boost.org/doc/libs/1_67_0/doc/html/boo=
st_units.html</a></div></div></div></blockquote><div><br></div><div>This ca=
n't handle nearly enough cases and is much more intrusive to the functi=
on - val is now a different type, this leaks into the implementation as wel=
l</div></div></blockquote><div><br></div><div>Different semantic meaning =
=3D=3D different type is a *good thing* as it allows relationships and oper=
ations to be checked at compile time. That means fewer bugs.=C2=A0</div><di=
v>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;=
border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div><br></di=
v><div>Also consider=C2=A0<br></div><div><font face=3D"courier new,monospac=
e"><span style=3D"display:inline!important;float:none;background-color:tran=
sparent;color:rgb(34,34,34);font-family:courier new,monospace;font-size:13p=
x;font-style:normal;font-variant:normal;font-weight:400;letter-spacing:norm=
al;text-align:left;text-decoration:none;text-indent:0px;text-transform:none=
;white-space:normal;word-spacing:0px">Rect(center: Point c, Size size);</sp=
an></font></div><div><font face=3D"courier new,monospace"><span style=3D"di=
splay: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;text-align:left;t=
ext-decoration:none;text-indent:0px;text-transform:none;white-space:normal;=
word-spacing:0px">Rect(topLeft: Point tl, Size size);</span><b></b><i></i><=
u></u><sub></sub><sup></sup><strike></strike><br></font></div><div><font fa=
ce=3D"courier new,monospace"><span style=3D"background-color:transparent;bo=
rder-bottom-color:rgb(34,34,34);border-bottom-style:none;border-bottom-widt=
h:0px;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;border-rig=
ht-width:0px;border-top-color:rgb(34,34,34);border-top-style:none;border-to=
p-width:0px;color:rgb(34,34,34);display:inline;float:none;font-family:couri=
er new,monospace;font-size:13px;font-style:normal;font-variant:normal;font-=
weight:400;letter-spacing:normal;margin-bottom:0px;margin-left:0px;margin-r=
ight:0px;margin-top:0px;padding-bottom:0px;padding-left:0px;padding-right:0=
px;padding-top:0px;text-align:left;text-decoration:none;text-indent:0px;tex=
t-transform:none;white-space:normal;word-spacing:0px">Rect(bottomLeft: Poin=
t bl, Size size);</span></font></div><div><font face=3D"courier new,monospa=
ce"><span style=3D"background-color:transparent;border-bottom-color:rgb(34,=
34,34);border-bottom-style:none;border-bottom-width:0px;border-left-color:r=
gb(34,34,34);border-left-style:none;border-left-width:0px;border-right-colo=
r:rgb(34,34,34);border-right-style:none;border-right-width:0px;border-top-c=
olor: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-siz=
e: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;p=
adding-bottom:0px;padding-left:0px;padding-right:0px;padding-top:0px;text-a=
lign:left;text-decoration:none;text-indent:0px;text-transform:none;white-sp=
ace:normal;word-spacing:0px"><br></span></font></div><div><span style=3D"ma=
rgin:0px;padding:0px;border:0px rgb(34,34,34);text-align:left;color:rgb(34,=
34,34);text-transform:none;text-indent:0px;letter-spacing:normal;font-size:=
13px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:=
none;word-spacing:0px;display:inline;white-space:normal;float:none;backgrou=
nd-color:transparent"><font face=3D"arial,sans-serif">Semantically some Bot=
tomLeftPointType is just wrong</font></span></div></div></blockquote><div><=
br></div><div>It's only wrong if the behaviour of a bottom-left point i=
s different to the behaviour of a top-left point. If it's not, then why=
bother tagging?</div><div>=C2=A0</div><blockquote class=3D"gmail_quote" st=
yle=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div =
dir=3D"ltr"><div><span style=3D"margin:0px;padding:0px;border:0px rgb(34,34=
,34);text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0p=
x;letter-spacing:normal;font-size:13px;font-style:normal;font-variant:norma=
l;font-weight:400;text-decoration:none;word-spacing:0px;display:inline;whit=
e-space:normal;float:none;background-color:transparent"><font face=3D"arial=
,sans-serif"><br></font></span></div><div><span style=3D"margin:0px;padding=
:0px;border:0px rgb(34,34,34);text-align:left;color:rgb(34,34,34);text-tran=
sform:none;text-indent:0px;letter-spacing:normal;font-size:13px;font-style:=
normal;font-variant:normal;font-weight:400;text-decoration:none;word-spacin=
g:0px;display:inline;white-space:normal;float:none;background-color:transpa=
rent"><font face=3D"arial,sans-serif"><br></font></span></div><div><span st=
yle=3D"margin:0px;padding:0px;border:0px rgb(34,34,34);text-align:left;colo=
r:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:normal;f=
ont-size:13px;font-style:normal;font-variant:normal;font-weight:400;text-de=
coration:none;word-spacing:0px;display:inline;white-space:normal;float:none=
;background-color:transparent"><font face=3D"arial,sans-serif">In general v=
ery often we want <i>both</i> the old types and the old function name, but =
to have a different implementation (to do something different).=C2=A0</font=
></span></div><div><span style=3D"margin:0px;padding:0px;border:0px rgb(34,=
34,34);text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:=
0px;letter-spacing:normal;font-size:13px;font-style:normal;font-variant:nor=
mal;font-weight:400;text-decoration:none;word-spacing:0px;display:inline;wh=
ite-space:normal;float:none;background-color:transparent"><font face=3D"ari=
al,sans-serif"><br></font></span></div><div><span style=3D"margin:0px;paddi=
ng:0px;border:0px rgb(34,34,34);text-align:left;color:rgb(34,34,34);text-tr=
ansform:none;text-indent:0px;letter-spacing:normal;font-size:13px;font-styl=
e:normal;font-variant:normal;font-weight:400;text-decoration:none;word-spac=
ing:0px;display:inline;white-space:normal;float:none;background-color:trans=
parent"><font face=3D"arial,sans-serif">This is why tags are so great and t=
his suggestion is just an extension of that, the same way structured bindin=
g are syntax sugar for the returned struct.</font></span></div><div><span s=
tyle=3D"margin:0px;padding:0px;border:0px rgb(34,34,34);text-align:left;col=
or:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:normal;=
font-size:13px;font-style:normal;font-variant:normal;font-weight:400;text-d=
ecoration:none;word-spacing:0px;display:inline;white-space:normal;float:non=
e;background-color:transparent"><font face=3D"arial,sans-serif"><br></font>=
</span></div><div><span style=3D"margin:0px;padding:0px;border:0px rgb(34,3=
4,34);text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0=
px;letter-spacing:normal;font-size:13px;font-style:normal;font-variant:norm=
al;font-weight:400;text-decoration:none;word-spacing:0px;display:inline;whi=
te-space:normal;float:none;background-color:transparent"><font face=3D"aria=
l,sans-serif"><br></font></span></div><div><span style=3D"margin:0px;paddin=
g:0px;border:0px rgb(34,34,34);text-align:left;color:rgb(34,34,34);text-tra=
nsform:none;text-indent:0px;letter-spacing:normal;font-size:13px;font-style=
:normal;font-variant:normal;font-weight:400;text-decoration:none;word-spaci=
ng:0px;display:inline;white-space:normal;float:none;background-color:transp=
arent"><font face=3D"arial,sans-serif">More real word examples (slightly mo=
dified)</font></span></div><font face=3D"courier new,monospace"><br>QImage(=
serializedData: const uchar *data, int size, const char *format =3D {}); <b=
r></font></div></blockquote><div><br></div><div><font face=3D"monospace, mo=
nospace">QImage(ByteBuffer const&, FormatString const&);=C2=A0 =C2=
=A0 // semantically meaningful, 1 fewer arguments, fewer errors</font></div=
><div><br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8e=
x;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><font face=
=3D"courier new,monospace"><br>QByteArray(base64: const QByteArray& val=
);<br>QByteArray(percentEncoded: const QByteArray& val, char percent =
=3D '%')<br><br>QByteArray(parseNumber: int val);=C2=A0<br>QByteArr=
ay(<span style=3D"display:inline!important;float:none;background-color:tran=
sparent;color:rgb(34,34,34);font-family:courier new,monospace;font-size:13p=
x;font-style:normal;font-variant:normal;font-weight:400;letter-spacing:norm=
al;text-align:left;text-decoration:none;text-indent:0px;text-transform:none=
;white-space:normal;word-spacing:0px">parseNumber</span>: double val);</fon=
t><div></div><div><b></b><i></i><u></u><sub></sub><sup></sup><strike></stri=
ke><font face=3D"courier new,monospace"></font><br></div><div>Note the last=
two in particular - special type will be=C2=A0 <i>completely</i> redundant=
- parseDoubleNumber{5} or something like that.</div></div></blockquote><di=
v><br></div><div><font face=3D"monospace, monospace">template<class Nume=
ric> struct parse_number { ... };</font></div><div><div style=3D"backgro=
und-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-co=
lor:initial"><font face=3D"monospace, monospace">QByteArray(parse_number(5)=
);=C2=A0 =C2=A0 //c++17 template type deduction yields parse_number<int&=
gt;</font></div><div style=3D"background-color:rgb(255,255,255);text-decora=
tion-style:initial;text-decoration-color:initial"><font face=3D"monospace, =
monospace">QByteArray(parse_number(5.0));=C2=A0=C2=A0<span style=3D"text-de=
coration-style:initial;text-decoration-color:initial;float:none;display:inl=
ine">//c++17 template type deduction yields parse_number<double></spa=
n></font></div><br class=3D"gmail-Apple-interchange-newline"><br></div><div=
>=C2=A0There was a great CppCon talk on this. It's worth seeking out.</=
div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-lef=
t:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div><br></div><div><br=
></div><div><font face=3D"courier new,monospace"><b></b><i></i><u></u><sub>=
</sub><sup></sup><strike></strike><b></b><i></i><u></u><sub></sub><sup></su=
p><strike></strike><b></b><i></i><u></u><sub></sub><sup></sup><strike></str=
ike><br></font></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" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/da3e4418-e043-4ad4-bab4-513ddd633abe%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/da3e4418-e043-=
4ad4-bab4-513ddd633abe%40isocpp.org</a>.<br>
</blockquote></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/CALvx3hbKvCUMGE5cr60Zu90Fia-ngcuwg2j%=
2B0zRTBSNzqupimA%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALvx3hbKvCUMGE=
5cr60Zu90Fia-ngcuwg2j%2B0zRTBSNzqupimA%40mail.gmail.com</a>.<br />
--00000000000008e990057090a43b--
.
Author: Thiago Macieira <thiago@macieira.org>
Date: Mon, 09 Jul 2018 07:40:36 -0700
Raw View
On Monday, 9 July 2018 05:03:18 PDT mihailnajdenov@gmail.com wrote:
> QByteArray(base64: const QByteArray& val);
> QByteArray(percentEncoded: const QByteArray& val, char percent = '%')
>
> QByteArray(parseNumber: int val);
> QByteArray(parseNumber: double val);
That's why we have "named constructors":
QByteArray::fromBase64
QByteArray::fromPercentEncoded
QByteArray::number
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Software Architect - Intel Open Source Technology Center
--
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/1682203.I8Rpk3jik2%40tjmaciei-mobl1.
.
Author: mihailnajdenov@gmail.com
Date: Mon, 9 Jul 2018 10:59:57 -0700 (PDT)
Raw View
------=_Part_110549_1846050553.1531159197793
Content-Type: multipart/alternative;
boundary="----=_Part_110550_441296213.1531159197793"
------=_Part_110550_441296213.1531159197793
Content-Type: text/plain; charset="UTF-8"
On Monday, July 9, 2018 at 5:40:44 PM UTC+3, Thiago Macieira wrote:
>
> On Monday, 9 July 2018 05:03:18 PDT mihailn...@gmail.com <javascript:>
> wrote:
> > QByteArray(base64: const QByteArray& val);
> > QByteArray(percentEncoded: const QByteArray& val, char percent = '%')
> >
> > QByteArray(parseNumber: int val);
> > QByteArray(parseNumber: double val);
>
> That's why we have "named constructors":
>
> QByteArray::fromBase64
> QByteArray::fromPercentEncoded
> QByteArray::number
>
This is exactly the problem trying to solve.
It is problem because:
1. Does not work with any form of generic code - the typesystem does not
know anything about "named ctors" it knows a ctor and args, that's it. No
make_ or allocator::construct can ever work.
2. The class is no longer self explanatory in terms of construction. No
intellySense and no reasoning reading the ctors in the header alone
3. The normal object creation is circumvented. No new QByteArray(fromBase64:
data)
4. There is still the issue with multiple arguments of the same type or
simply too many arguments and tricks or conventions must be employed
>
> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
> Software Architect - Intel Open Source Technology Center
>
>
>
>
--
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/ab004c59-15d4-4dea-a1b8-e9f7d2c4fabc%40isocpp.org.
------=_Part_110550_441296213.1531159197793
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Monday, July 9, 2018 at 5:40:44 PM UTC+3, Thiag=
o Macieira wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margi=
n-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">On Monday, 9 =
July 2018 05:03:18 PDT <a onmousedown=3D"this.href=3D'javascript:';=
return true;" onclick=3D"this.href=3D'javascript:';return true;" hr=
ef=3D"javascript:" target=3D"_blank" rel=3D"nofollow" gdf-obfuscated-mailto=
=3D"A4UYbj7NBQAJ">mihailn...@gmail.com</a> wrote:
<br>> QByteArray(base64: const QByteArray& val);
<br>> QByteArray(percentEncoded: const QByteArray& val, char percent=
=3D '%')
<br>>=20
<br>> QByteArray(parseNumber: int val);
<br>> QByteArray(parseNumber: double val);
<br>
<br>That's why we have "named constructors":
<br>
<br>QByteArray::fromBase64
<br>QByteArray::fromPercentEncoded
<br>QByteArray::number=C2=A0<br></blockquote><div><br></div><div>This is ex=
actly the problem trying to solve.</div><div><br></div><div>It is problem b=
ecause:</div><ol><li>Does not work with any form of generic code - the type=
system does not know anything about "named ctors" it knows a ctor=
and args, that's it. No <font face=3D"courier new,monospace">make_</fo=
nt> or <font face=3D"courier new,monospace">allocator::construct</font><spa=
n style=3D"display: inline !important; float: none; background-color: trans=
parent; color: rgb(0, 0, 0); font-family: DejaVuSans,"DejaVu Sans"=
;,arial,sans-serif; font-size: 25.6px; font-style: normal; font-variant: no=
rmal; font-weight: 400; letter-spacing: normal; line-height: 30.72px; orpha=
ns: 2; text-align: left; text-decoration: none; text-indent: 0px; text-tran=
sform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spac=
ing: 0px;"></span>=C2=A0 can ever work.</li><li>The class is no longer self=
explanatory in terms of construction. No intellySense and no reasoning rea=
ding the ctors in the header alone</li><li>The normal object creation is ci=
rcumvented. No <font face=3D"courier new,monospace">new </font><span style=
=3D"display: inline !important; float: none; background-color: transparent;=
color: rgb(34, 34, 34); font-family: "Arial","Helvetica&quo=
t;,sans-serif; font-size: 13px; font-style: normal; font-variant: normal; f=
ont-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text=
-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-str=
oke-width: 0px; white-space: normal; word-spacing: 0px;"><font face=3D"cour=
ier new,monospace">QByteArray(fromBase64: data)=C2=A0</font></span></li><li=
><span style=3D"text-align: left; color: rgb(34, 34, 34); text-transform: n=
one; text-indent: 0px; letter-spacing: normal; font-size: 13px; font-style:=
normal; font-variant: normal; font-weight: 400; text-decoration: none; wor=
d-spacing: 0px; display: inline !important; white-space: normal; orphans: 2=
; float: none; -webkit-text-stroke-width: 0px; background-color: transparen=
t;"><font face=3D"arial,sans-serif">There is still the issue with multiple =
arguments of the same type or simply too many arguments and tricks or conve=
ntions must be employed</font><br></span></li></ol><div><font face=3D"arial=
,sans-serif"></font><br></div><div>=C2=A0</div><blockquote class=3D"gmail_q=
uote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;pad=
ding-left: 1ex;">
<br>--=20
<br>Thiago Macieira - thiago (AT) <a onmousedown=3D"this.href=3D'http:/=
/www.google.com/url?q\x3dhttp%3A%2F%2Fmacieira.info\x26sa\x3dD\x26sntz\x3d1=
\x26usg\x3dAFQjCNEswDUBNCNanbu7euhqLn_62FW8ag';return true;" onclick=3D=
"this.href=3D'http://www.google.com/url?q\x3dhttp%3A%2F%2Fmacieira.info=
\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEswDUBNCNanbu7euhqLn_62FW8ag';=
return true;" href=3D"http://macieira.info" target=3D"_blank" rel=3D"nofoll=
ow">macieira.info</a> - thiago (AT) <a onmousedown=3D"this.href=3D'http=
://www.google.com/url?q\x3dhttp%3A%2F%2Fkde.org\x26sa\x3dD\x26sntz\x3d1\x26=
usg\x3dAFQjCNHGRJdo5_JYG1DowztwAHAKs80XSA';return true;" onclick=3D"thi=
s.href=3D'http://www.google.com/url?q\x3dhttp%3A%2F%2Fkde.org\x26sa\x3d=
D\x26sntz\x3d1\x26usg\x3dAFQjCNHGRJdo5_JYG1DowztwAHAKs80XSA';return tru=
e;" href=3D"http://kde.org" target=3D"_blank" rel=3D"nofollow">kde.org</a>
<br>=C2=A0 =C2=A0Software Architect - Intel Open Source Technology Center
<br>
<br>
<br>
<br></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/ab004c59-15d4-4dea-a1b8-e9f7d2c4fabc%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/ab004c59-15d4-4dea-a1b8-e9f7d2c4fabc=
%40isocpp.org</a>.<br />
------=_Part_110550_441296213.1531159197793--
------=_Part_110549_1846050553.1531159197793--
.
Author: mihailnajdenov@gmail.com
Date: Mon, 9 Jul 2018 11:56:27 -0700 (PDT)
Raw View
------=_Part_110958_324298937.1531162588126
Content-Type: multipart/alternative;
boundary="----=_Part_110959_1408536446.1531162588127"
------=_Part_110959_1408536446.1531162588127
Content-Type: text/plain; charset="UTF-8"
On Monday, July 9, 2018 at 4:03:35 PM UTC+3, Richard Hodges wrote:
>
>
>
> On Mon, 9 Jul 2018 at 14:03, <mihailn...@gmail.com <javascript:>> wrote:
>
>>
>>
>> On Monday, July 9, 2018 at 1:38:12 PM UTC+3, Richard Hodges wrote:
>>>
>>>
>>>
>>> On Mon, 9 Jul 2018 at 12:01, <mihailn...@gmail.com> wrote:
>>>
>>>>
>>>> I got an idea this morning, here it is in code
>>>>
>>>>
>>>> void func( width: int val );
>>>> void func( height: int val );
>>>>
>>>
>>> Starting to look a lot like objective-c's loathsome syntax.
>>>
>>> We can already do:
>>>
>>> void func(height val);
>>> void func(width val);
>>>
>>> Where
>>>
>>> using height = tagged_value<struct height_tag, int>;
>>> template<typename Tag> struct tagged_value { .. implement in terms of
>>> services expressed by the tag... };
>>>
>>> Which is IMHO more expressive.
>>>
>>> An existing (very complete) model of this:
>>> https://www.boost.org/doc/libs/1_67_0/doc/html/boost_units.html
>>>
>>
>> This can't handle nearly enough cases and is much more intrusive to the
>> function - val is now a different type, this leaks into the implementation
>> as well
>>
>
>
> Different semantic meaning == different type is a *good thing* as it
> allows relationships and operations to be checked at compile time. That
> means fewer bugs.
>
>
>>
>> Also consider
>> Rect(center: Point c, Size size);
>> Rect(topLeft: Point tl, Size size);
>> Rect(bottomLeft: Point bl, Size size);
>>
>> Semantically some BottomLeftPointType is just wrong
>>
>
> It's only wrong if the behaviour of a bottom-left point is different to
> the behaviour of a top-left point. If it's not, then why bother tagging?
>
The user must say what point he is supplying so the ctor can fill the rest
by using size.
Rect({0, 0}, {10, 12}) // top:0 left:0 bottom: 12 right:10
Rect(center: {0, 0}, {10, 12}) // top:-5 left:-6 bottom: 5 right: 6
The points are the same, making them different type is wrong semantically
as you probably agree.
>
>>
>>
>> In general very often we want *both* the old types and the old function
>> name, but to have a different implementation (to do something different).
>>
>> This is why tags are so great and this suggestion is just an extension of
>> that, the same way structured binding are syntax sugar for the returned
>> struct.
>>
>>
>> More real word examples (slightly modified)
>>
>> QImage(serializedData: const uchar *data, int size, const char *format =
>> {});
>>
>
> QImage(ByteBuffer const&, FormatString const&); // semantically
> meaningful, 1 fewer arguments, fewer errors
>
This still does not work - ByteBuffer can be raw pixel data or can be
compressed (Jpeg) and the format can be omitted. We must introduce
SerializedByteBuffer.
Note that I agree with you in principal, but new type can be redundant (if
used just in one place) or it might not scale - there might be dozens
overloads
>
>
>> QByteArray(base64: const QByteArray& val);
>> QByteArray(percentEncoded: const QByteArray& val, char percent = '%')
>>
>> QByteArray(parseNumber: int val);
>> QByteArray(parseNumber: double val);
>>
>> Note the last two in particular - special type will be *completely*
>> redundant - parseDoubleNumber{5} or something like that.
>>
>
> template<class Numeric> struct parse_number { ... };
> QByteArray(parse_number(5)); //c++17 template type deduction yields
> parse_number<int>
> QByteArray(parse_number(5.0)); //c++17 template type deduction yields
> parse_number<double>
>
This is confusing as it looks like we create a byte array by a function (or
functor) and pass it to the a ctor.
It also leaks detail into the implementation - we must code in terms of
some odd parse_number argument.
This is just a workaround, not something semantically better (as arguably
the Buffer example)
In general named params are The Right Solution if the types must
semantically stay the same (incl. in the implementation) - Points, numbers,
but often strings, images.
- First, middle, last name should not be a different type (well depends
on the language, but you get the idea).
- Window title icon and window tray icon should not be a different type.
- Header text should not be different type then Footer text
- Tooltip and status text are the same type of string
- 16x16, 24x24, 32x32 etc in a icon class are the same type - an image
Honestly, the list is long, we just don't notice it as we learned to get
around of it in one form or another,
modeling our interfaces around the issues or simply dropping useful
interfaces as they are hard or cumbersome to express .
>
>
> There was a great CppCon talk on this. It's worth seeking out.
>
>>
>>
>>
>> --
>> 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-proposal...@isocpp.org <javascript:>.
>> To post to this group, send email to std-pr...@isocpp.org <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/da3e4418-e043-4ad4-bab4-513ddd633abe%40isocpp.org
>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/da3e4418-e043-4ad4-bab4-513ddd633abe%40isocpp.org?utm_medium=email&utm_source=footer>
>> .
>>
>
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/41949fb9-c3b6-4d16-a760-2d9064bce683%40isocpp.org.
------=_Part_110959_1408536446.1531162588127
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Monday, July 9, 2018 at 4:03:35 PM UTC+3, Richa=
rd Hodges 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"lt=
r"><br><br><div class=3D"gmail_quote"><div dir=3D"ltr">On Mon, 9 Jul 2018 a=
t 14:03, <<a onmousedown=3D"this.href=3D'javascript:';return tru=
e;" onclick=3D"this.href=3D'javascript:';return true;" href=3D"java=
script:" target=3D"_blank" rel=3D"nofollow" gdf-obfuscated-mailto=3D"JBQ1R_=
HHBQAJ">mihailn...@gmail.com</a>> wrote:<br></div><blockquote class=3D"g=
mail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-l=
eft:1ex"><div dir=3D"ltr"><br><br>On Monday, July 9, 2018 at 1:38:12 PM UTC=
+3, Richard Hodges 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"><br><br><div class=3D"gmail_quote"><div dir=3D"ltr">On Mon, 9 Jul =
2018 at 12:01, <<a rel=3D"nofollow">mihailn...@gmail.com</a>> wrote:<=
br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8e=
x;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=3D"ltr"=
><div><br></div><div>I got an idea this morning, here it is in code</div><d=
iv><br></div><div><font face=3D"courier new,monospace"><br></font></div><di=
v><font face=3D"courier new,monospace">void func(=C2=A0 width: int val );<b=
r>void func(=C2=A0 height: int val );</font></div></div></blockquote><div><=
br></div><div>Starting to look a lot like objective-c's=C2=A0<span styl=
e=3D"font-size:small;background-color:rgb(255,255,255);float:none;display:i=
nline">loathsome<span>=C2=A0<wbr>syntax.</span></span></div><div><span styl=
e=3D"font-size:small;background-color:rgb(255,255,255);float:none;display:i=
nline"><span><br></span></span></div><div><span style=3D"font-size:small;ba=
ckground-color:rgb(255,255,255);float:none;display:inline"><span>We can alr=
eady do:</span></span></div><div><span style=3D"font-size:small;background-=
color:rgb(255,255,255);float:none;display:inline"><span><br></span></span><=
/div><div><div style=3D"font-size:small;background-color:rgb(255,255,255)">=
<span style=3D"font-size:small;background-color:rgb(255,255,255);float:none=
;display:inline"><span><font face=3D"monospace, monospace">void func(height=
val);</font></span></span></div><div style=3D"font-size:small;background-c=
olor:rgb(255,255,255)"><span style=3D"font-size:small;background-color:rgb(=
255,255,255);float:none;display:inline"><span><font face=3D"monospace, mono=
space">void func(width val);</font></span></span></div><div><br></div>Where=
</div><div><br></div><div><font face=3D"monospace, monospace">using height =
=3D tagged_value<struct height_tag, int>;</font></div><div><font face=
=3D"monospace, monospace">template<typename Tag> struct <span style=
=3D"font-size:small;background-color:rgb(255,255,255);float:none;display:in=
line">tagged_value { .. implement in terms of services expressed by the tag=
.... };</span></font></div><div><br></div><div>=C2=A0Which is IMHO more expr=
essive.</div><div><br></div><div>An existing (very complete) model of this:=
=C2=A0<a onmousedown=3D"this.href=3D'https://www.google.com/url?q\x3dht=
tps%3A%2F%2Fwww.boost.org%2Fdoc%2Flibs%2F1_67_0%2Fdoc%2Fhtml%2Fboost_units.=
html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHfsIv8WL2pPVFxDMmIoV22x7Nsog&#=
39;;return true;" onclick=3D"this.href=3D'https://www.google.com/url?q\=
x3dhttps%3A%2F%2Fwww.boost.org%2Fdoc%2Flibs%2F1_67_0%2Fdoc%2Fhtml%2Fboost_u=
nits.html\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHfsIv8WL2pPVFxDMmIoV22x7N=
sog';return true;" href=3D"https://www.boost.org/doc/libs/1_67_0/doc/ht=
ml/boost_units.html" target=3D"_blank" rel=3D"nofollow">https://www.boost.o=
rg/<wbr>doc/libs/1_67_0/doc/html/<wbr>boost_units.html</a></div></div></div=
></blockquote><div><br></div><div>This can't handle nearly enough cases=
and is much more intrusive to the function - val is now a different type, =
this leaks into the implementation as well</div></div></blockquote><div><br=
></div></div></div></blockquote><div>=C2=A0</div><blockquote class=3D"gmail=
_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;p=
adding-left: 1ex;"><div dir=3D"ltr"><div class=3D"gmail_quote"><div></div><=
div>Different semantic meaning =3D=3D different type is a *good thing* as i=
t allows relationships and operations to be checked at compile time. That m=
eans fewer bugs.=C2=A0</div><div>=C2=A0</div><blockquote class=3D"gmail_quo=
te" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"=
><div dir=3D"ltr"><div><br></div><div>Also consider=C2=A0<br></div><div><fo=
nt face=3D"courier new,monospace"><span style=3D"display:inline!important;f=
loat:none;background-color:transparent;color:rgb(34,34,34);font-family:cour=
ier new,monospace;font-size:13px;font-style:normal;font-variant:normal;font=
-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text=
-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">Rect(c=
enter: Point c, Size size);</span></font></div><div><font face=3D"courier n=
ew,monospace"><span style=3D"display:inline!important;float:none;background=
-color:transparent;color:rgb(34,34,34);font-family:courier new,monospace;fo=
nt-size:13px;font-style:normal;font-variant:normal;font-weight:400;letter-s=
pacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-tra=
nsform:none;white-space:normal;word-spacing:0px">Rect(topLeft: Point tl, Si=
ze size);</span><b></b><i></i><u></u><sub></sub><sup></sup><strike></strike=
><br></font></div><div><font face=3D"courier new,monospace"><span style=3D"=
background-color:transparent;border-bottom-color:rgb(34,34,34);border-botto=
m-style:none;border-bottom-width:0px;border-left-color:rgb(34,34,34);border=
-left-style:none;border-left-width:0px;border-right-color:rgb(34,34,34);bor=
der-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:inli=
ne;float:none;font-family:courier new,monospace;font-size:13px;font-style:n=
ormal;font-variant:normal;font-weight:400;letter-spacing:normal;margin-bott=
om:0px;margin-left:0px;margin-right:0px;margin-top:0px;padding-bottom:0px;p=
adding-left:0px;padding-right:0px;padding-top:0px;text-align:left;text-deco=
ration:none;text-indent:0px;text-transform:none;white-space:normal;word-spa=
cing:0px">Rect(bottomLeft: Point bl, Size size);</span></font></div><div><f=
ont face=3D"courier new,monospace"><span style=3D"background-color:transpar=
ent;border-bottom-color:rgb(34,34,34);border-bottom-style:none;border-botto=
m-width:0px;border-left-color:rgb(34,34,34);border-left-style:none;border-l=
eft-width:0px;border-right-color:rgb(34,34,34);border-right-style:none;bord=
er-right-width:0px;border-top-color:rgb(34,34,34);border-top-style:none;bor=
der-top-width:0px;color:rgb(34,34,34);display:inline;float:none;font-family=
:courier new,monospace;font-size:13px;font-style:normal;font-variant:normal=
;font-weight:400;letter-spacing:normal;margin-bottom:0px;margin-left:0px;ma=
rgin-right:0px;margin-top:0px;padding-bottom:0px;padding-left:0px;padding-r=
ight:0px;padding-top:0px;text-align:left;text-decoration:none;text-indent:0=
px;text-transform:none;white-space:normal;word-spacing:0px"><br></span></fo=
nt></div><div><span style=3D"margin:0px;padding:0px;border:0px rgb(34,34,34=
);text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0px;l=
etter-spacing:normal;font-size:13px;font-style:normal;font-variant:normal;f=
ont-weight:400;text-decoration:none;word-spacing:0px;display:inline;white-s=
pace:normal;float:none;background-color:transparent"><font face=3D"arial,sa=
ns-serif">Semantically some BottomLeftPointType is just wrong</font></span>=
</div></div></blockquote><div><br></div><div>It's only wrong if the beh=
aviour of a bottom-left point is different to the behaviour of a top-left p=
oint. If it's not, then why bother tagging?</div></div></div></blockquo=
te><div><br></div><div>The user must say what point he is supplying so the =
ctor can fill the rest by using size.=C2=A0</div><div><br></div><div><font =
face=3D"courier new,monospace">Rect({0, 0}, {10, 12}) // top:0 left:0 botto=
m: 12 right:10</font></div><div><div style=3D"background-color: transparent=
; border-bottom-color: rgb(34, 34, 34); border-bottom-style: none; border-b=
ottom-width: 0px; border-image-outset: 0; border-image-repeat: stretch; bor=
der-image-slice: 100%; border-image-source: none; border-image-width: 1; bo=
rder-left-color: rgb(34, 34, 34); border-left-style: none; border-left-widt=
h: 0px; border-right-color: rgb(34, 34, 34); border-right-style: none; bord=
er-right-width: 0px; border-top-color: rgb(34, 34, 34); border-top-style: n=
one; 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:=
normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-to=
p: 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: 0px; white-space: n=
ormal; word-spacing: 0px;"><font face=3D"courier new,monospace"></font><br =
style=3D"background-attachment: scroll; background-clip: border-box; backgr=
ound-color: transparent; background-image: none; background-origin: padding=
-box; background-position-x: 0%; background-position-y: 0%; background-repe=
at: repeat; background-size: auto; border-bottom-color: rgb(34, 34, 34); bo=
rder-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, 34); border-l=
eft-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&qu=
ot;,sans-serif; font-size: 13px; height: auto; margin-bottom: 0px; margin-l=
eft: 0px; margin-right: 0px; margin-top: 0px; min-width: 0px; overflow: vis=
ible; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; paddin=
g-left: 0px; padding-right: 0px; padding-top: 0px;"></div><div style=3D"bac=
kground-color: transparent; border-bottom-color: rgb(34, 34, 34); border-bo=
ttom-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, 34); border-left-sty=
le: none; border-left-width: 0px; border-right-color: rgb(34, 34, 34); bord=
er-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;,san=
s-serif; font-size: 13px; font-style: normal; font-variant: normal; font-we=
ight: 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; ma=
rgin-right: 0px; margin-top: 0px; orphans: 2; padding-bottom: 0px; padding-=
left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; text-dec=
oration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-=
width: 0px; white-space: normal; word-spacing: 0px;"><font face=3D"courier =
new,monospace">Rect(center: {0, 0}, {10, 12}) // top:-5 left:-6 bottom: 5 r=
ight: 6</font></div><b></b><i></i><u></u><sub></sub><sup></sup><strike></st=
rike><font face=3D"courier new,monospace"></font><br></div><div>=C2=A0<span=
style=3D"display: inline !important; float: none; background-color: transp=
arent; color: rgb(34, 34, 34); font-family: "Arial","Helveti=
ca",sans-serif; font-size: 13px; font-style: normal; font-variant: nor=
mal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: left=
; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-te=
xt-stroke-width: 0px; white-space: normal; word-spacing: 0px;">The points a=
re the same, making them different type is wrong semantically as you probab=
ly agree.</span></div><div><span style=3D"display: inline !important; float=
: none; background-color: transparent; color: rgb(34, 34, 34); font-family:=
"Arial","Helvetica",sans-serif; font-size: 13px; font-=
style: normal; font-variant: normal; font-weight: 400; letter-spacing: norm=
al; 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;"><br></span></div><blockquote class=3D"gmail_quote" styl=
e=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left:=
1ex;"><div dir=3D"ltr"><div class=3D"gmail_quote"><div>=C2=A0</div><blockq=
uote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc =
solid;padding-left:1ex"><div dir=3D"ltr"><div><span style=3D"margin:0px;pad=
ding:0px;border:0px rgb(34,34,34);text-align:left;color:rgb(34,34,34);text-=
transform:none;text-indent:0px;letter-spacing:normal;font-size:13px;font-st=
yle:normal;font-variant:normal;font-weight:400;text-decoration:none;word-sp=
acing:0px;display:inline;white-space:normal;float:none;background-color:tra=
nsparent"><font face=3D"arial,sans-serif"><br></font></span></div><div><spa=
n style=3D"margin:0px;padding:0px;border:0px rgb(34,34,34);text-align:left;=
color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:norm=
al;font-size:13px;font-style:normal;font-variant:normal;font-weight:400;tex=
t-decoration:none;word-spacing:0px;display:inline;white-space:normal;float:=
none;background-color:transparent"><font face=3D"arial,sans-serif"><br></fo=
nt></span></div><div><span style=3D"margin:0px;padding:0px;border:0px rgb(3=
4,34,34);text-align:left;color:rgb(34,34,34);text-transform:none;text-inden=
t:0px;letter-spacing:normal;font-size:13px;font-style:normal;font-variant:n=
ormal;font-weight:400;text-decoration:none;word-spacing:0px;display:inline;=
white-space:normal;float:none;background-color:transparent"><font face=3D"a=
rial,sans-serif">In general very often we want <i>both</i> the old types an=
d the old function name, but to have a different implementation (to do some=
thing different).=C2=A0</font></span></div><div><span style=3D"margin:0px;p=
adding:0px;border:0px rgb(34,34,34);text-align:left;color:rgb(34,34,34);tex=
t-transform:none;text-indent:0px;letter-spacing:normal;font-size:13px;font-=
style:normal;font-variant:normal;font-weight:400;text-decoration:none;word-=
spacing:0px;display:inline;white-space:normal;float:none;background-color:t=
ransparent"><font face=3D"arial,sans-serif"><br></font></span></div><div><s=
pan style=3D"margin:0px;padding:0px;border:0px rgb(34,34,34);text-align:lef=
t;color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:no=
rmal;font-size:13px;font-style:normal;font-variant:normal;font-weight:400;t=
ext-decoration:none;word-spacing:0px;display:inline;white-space:normal;floa=
t:none;background-color:transparent"><font face=3D"arial,sans-serif">This i=
s why tags are so great and this suggestion is just an extension of that, t=
he same way structured binding are syntax sugar for the returned struct.</f=
ont></span></div><div><span style=3D"margin:0px;padding:0px;border:0px rgb(=
34,34,34);text-align:left;color:rgb(34,34,34);text-transform:none;text-inde=
nt:0px;letter-spacing:normal;font-size:13px;font-style:normal;font-variant:=
normal;font-weight:400;text-decoration:none;word-spacing:0px;display:inline=
;white-space:normal;float:none;background-color:transparent"><font face=3D"=
arial,sans-serif"><br></font></span></div><div><span style=3D"margin:0px;pa=
dding:0px;border:0px rgb(34,34,34);text-align:left;color:rgb(34,34,34);text=
-transform:none;text-indent:0px;letter-spacing:normal;font-size:13px;font-s=
tyle:normal;font-variant:normal;font-weight:400;text-decoration:none;word-s=
pacing:0px;display:inline;white-space:normal;float:none;background-color:tr=
ansparent"><font face=3D"arial,sans-serif"><br></font></span></div><div><sp=
an style=3D"margin:0px;padding:0px;border:0px rgb(34,34,34);text-align:left=
;color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:nor=
mal;font-size:13px;font-style:normal;font-variant:normal;font-weight:400;te=
xt-decoration:none;word-spacing:0px;display:inline;white-space:normal;float=
:none;background-color:transparent"><font face=3D"arial,sans-serif">More re=
al word examples (slightly modified)</font></span></div><font face=3D"couri=
er new,monospace"><br>QImage(serializedData: const uchar *data, int size, c=
onst char *format =3D {}); <br></font></div></blockquote><div><br></div><di=
v><font face=3D"monospace, monospace">QImage(ByteBuffer const&, FormatS=
tring const&);=C2=A0 =C2=A0 // semantically meaningful, 1 fewer argumen=
ts, fewer errors</font></div></div></div></blockquote><div><br></div><div><=
br></div><div>This still does not work - ByteBuffer can be raw pixel data o=
r can be compressed (Jpeg) and the format can be omitted. We must introduce=
SerializedByteBuffer.=C2=A0</div><div><br></div><div>Note that I agree wit=
h you in principal, but new type can be redundant (if used just in one plac=
e) or it might not scale - there might be dozens overloads</div><div>=C2=A0=
</div><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8=
ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div cl=
ass=3D"gmail_quote"><div><br></div><blockquote class=3D"gmail_quote" style=
=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=
=3D"ltr"><font face=3D"courier new,monospace"><br>QByteArray(base64: const =
QByteArray& val);<br>QByteArray(percentEncoded: const QByteArray& v=
al, char percent =3D '%')<br><br>QByteArray(parseNumber: int val);=
=C2=A0<br>QByteArray(<span style=3D"display:inline!important;float:none;bac=
kground-color:transparent;color:rgb(34,34,34);font-family:courier new,monos=
pace;font-size:13px;font-style:normal;font-variant:normal;font-weight:400;l=
etter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;t=
ext-transform:none;white-space:normal;word-spacing:0px">parseNumber</span>:=
double val);</font><div></div><div><b></b><i></i><u></u><sub></sub><sup></=
sup><strike></strike><font face=3D"courier new,monospace"></font><br></div>=
<div>Note the last two in particular - special type will be=C2=A0 <i>comple=
tely</i> redundant - parseDoubleNumber{5} or something like that.</div></di=
v></blockquote><div><br></div><div><font face=3D"monospace, monospace">temp=
late<class Numeric> struct parse_number { ... };</font></div><div><di=
v style=3D"background-color:rgb(255,255,255)"><font face=3D"monospace, mono=
space">QByteArray(parse_number(5));=C2=A0 =C2=A0 //c++17 template type dedu=
ction yields parse_number<int></font></div><div style=3D"background-c=
olor:rgb(255,255,255)"><font face=3D"monospace, monospace">QByteArray(parse=
_number(5.0));<wbr>=C2=A0=C2=A0<span style=3D"float:none;display:inline">//=
c++17 template type deduction yields parse_number<double></span></fon=
t></div></div></div></div></blockquote><div><br></div><div>This is confusin=
g as it looks like we create a byte array by a function (or functor) and pa=
ss it to the a ctor.</div><div>It also leaks detail into the implementation=
- we must code in terms of some odd <span style=3D"display: inline !import=
ant; float: none; background-color: transparent; color: rgb(34, 34, 34); fo=
nt-family: monospace, 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-transform: none=
; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">=
parse_number <font face=3D"arial,sans-serif">argument.=C2=A0</font></span><=
/div><div><span style=3D"display: inline !important; float: none; backgroun=
d-color: transparent; color: rgb(34, 34, 34); font-family: monospace, monos=
pace; font-size: 13px; font-style: normal; font-variant: normal; font-weigh=
t: 400; letter-spacing: normal; orphans: 2; 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"arial,sans-se=
rif"><br></font></span></div><div><span style=3D"display: inline !important=
; float: none; background-color: transparent; color: rgb(34, 34, 34); font-=
family: monospace, monospace; font-size: 13px; font-style: normal; font-var=
iant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; 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"arial,sans-serif">This is just a workaround, not something seman=
tically better (as arguably the Buffer example)</font></span></div><div><br=
></div><div><br></div><div>In general named params are The Right Solution i=
f the types must semantically stay the same (incl. in the implementation) -=
Points, numbers, but often strings, images.</div><div><br></div><ul><li><f=
ont face=3D"arial,sans-serif">First, middle, last name should not be a diff=
erent type (well depends on the language, but you get the idea).=C2=A0</fon=
t></li><li><font face=3D"arial,sans-serif">Window title icon and window tra=
y icon should not be a different type.</font></li><li><font face=3D"arial,s=
ans-serif">Header text should not be different type then Footer text</font>=
</li><li><font face=3D"arial,sans-serif">Tooltip and status text are the sa=
me type of string</font></li><li><font face=3D"arial,sans-serif">16x16, 24x=
24, 32x32 etc in a icon class are the same type - an image<br></font></li><=
/ul><font face=3D"arial,sans-serif"><div>Honestly, the list is long, we jus=
t don't notice it as we learned to get around of it in one form or anot=
her,</div><div>modeling our interfaces around the issues or simply dropping=
useful interfaces as they are hard or cumbersome to express .</div></font>=
<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 class=3D"gmail_quote"><div><br><br></div><div>=C2=A0There was a gr=
eat CppCon talk on this. It's worth seeking out.</div><blockquote class=
=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padd=
ing-left:1ex"><div dir=3D"ltr"><div><br></div><div><br></div><div><font fac=
e=3D"courier new,monospace"><b></b><i></i><u></u><sub></sub><sup></sup><str=
ike></strike><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></font></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 onmousedown=3D"this.href=3D'javascript:';return true;" o=
nclick=3D"this.href=3D'javascript:';return true;" href=3D"javascrip=
t:" target=3D"_blank" rel=3D"nofollow" gdf-obfuscated-mailto=3D"JBQ1R_HHBQA=
J">std-proposal...@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a onmousedown=3D"this.href=3D'jav=
ascript:';return true;" onclick=3D"this.href=3D'javascript:';re=
turn true;" href=3D"javascript:" target=3D"_blank" rel=3D"nofollow" gdf-obf=
uscated-mailto=3D"JBQ1R_HHBQAJ">std-pr...@isocpp.org</a>.<br>
To view this discussion on the web visit <a onmousedown=3D"this.href=3D'=
;https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/da3e4418-e043=
-4ad4-bab4-513ddd633abe%40isocpp.org?utm_medium\x3demail\x26utm_source\x3df=
ooter';return true;" onclick=3D"this.href=3D'https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/da3e4418-e043-4ad4-bab4-513ddd633abe=
%40isocpp.org?utm_medium\x3demail\x26utm_source\x3dfooter';return true;=
" href=3D"https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/da3e=
4418-e043-4ad4-bab4-513ddd633abe%40isocpp.org?utm_medium=3Demail&utm_so=
urce=3Dfooter" target=3D"_blank" rel=3D"nofollow">https://groups.google.com=
/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/da3e4418-e043-4ad4-<wbr>bab4-=
513ddd633abe%40isocpp.org</a><wbr>.<br>
</blockquote></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/41949fb9-c3b6-4d16-a760-2d9064bce683%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/41949fb9-c3b6-4d16-a760-2d9064bce683=
%40isocpp.org</a>.<br />
------=_Part_110959_1408536446.1531162588127--
------=_Part_110958_324298937.1531162588126--
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Mon, 9 Jul 2018 14:52:45 -0700 (PDT)
Raw View
------=_Part_81515_250525056.1531173166036
Content-Type: multipart/alternative;
boundary="----=_Part_81516_189590681.1531173166036"
------=_Part_81516_189590681.1531173166036
Content-Type: text/plain; charset="UTF-8"
On Monday, July 9, 2018 at 6:00:59 AM UTC-4, mihailn...@gmail.com wrote:
>
> Basically we can have beautiful and teachable interfaces and the tag stays
> as implementation detail.
>
But it's *not* an "implementation detail".
Can I pass `func` to a `std::function<void(int)>`? I rather suspect not.
Indeed, overloading aside, what would `&func` return? It would have to be a
`void(*)(tag_type<"width">, int)`, right? So it's hardly an implementation
detail; it changes the signature of the function.
This kind of design reminds me of the Coroutines TS: it start with a syntax
and preferred behavior, then does whatever it takes to make that syntax
have the preferred behavior. Comparatively, the Core Corotines proposal is
about providing mechanisms which can be used to implement the preferred
behavior.
What I mean is this: your proposal is really three related mechanisms. The
first is a way to convert an identifier into a type. The second is a way to
pass this identifier/type as a function parameter so that it doesn't look
like a function parameter at all. And the third is a way to declare a
function that receives this identifier/type as a function parameter, but
not using regular function parameter syntax.
I would much rather see this broken down into individual mechanisms. For
example, why does it *need* to be an identifier? If the calling code were:
func("width", width);
Would that be so awful? Is the specialized syntax absolutely *necessary*?
Because if we don't need that, then we can get that "right now" with
C++20's ability to have strings as type parameters:
func("width"tag, width);
Where `tag` is a UDL which converts the given string into a `func_tag` type.
Now sure, when you declare the function, you have to include a bit of
cruft. But quite frankly, tagged parameters of this sort should not be so
common that such cruft appears frequently in code. This is mainly for
one-off cases like top-left vs. bottom-left rectangle coordinates. For
something like angles, you genuinely want to wrap the number in a real type
(since it involves units).
C++20 gets us close enough that we really don't need specialized syntax.
--
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/de66100c-8d18-45fc-b126-cda0079cfdbb%40isocpp.org.
------=_Part_81516_189590681.1531173166036
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Monday, July 9, 2018 at 6:00:59 AM UTC-4, mihailn...@gm=
ail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-l=
eft: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"=
><div><span style=3D"text-align:left;color:rgb(34,34,34);text-transform:non=
e;text-indent:0px;letter-spacing:normal;font-size:13px;font-style:normal;fo=
nt-variant:normal;font-weight:400;text-decoration:none;word-spacing:0px;dis=
play:inline!important;white-space:normal;float:none;background-color:transp=
arent"><font face=3D"arial,sans-serif">Basically we can have beautiful and =
teachable interfaces and the tag stays as implementation detail.</font></sp=
an></div></div></blockquote><div><br></div><div>But it's <i>not</i> an =
"implementation detail".</div><div><br></div><div>Can I pass `fun=
c` to a `std::function<void(int)>`? I rather suspect not. Indeed, ove=
rloading aside, what would `&func` return? It would have to be a `void(=
*)(tag_type<"width">, int)`, right? So it's hardly an i=
mplementation detail; it changes the signature of the function.</div><div><=
br></div><div>This kind of design reminds me of the Coroutines TS: it start=
with a syntax and preferred behavior, then does whatever it takes to make =
that syntax have the preferred behavior. Comparatively, the Core Corotines =
proposal is about providing mechanisms which can be used to implement the p=
referred behavior.</div><div><br></div><div>What I mean is this: your propo=
sal is really three related mechanisms. The first is a way to convert an id=
entifier into a type. The second is a way to pass this identifier/type as a=
function parameter so that it doesn't look like a function parameter a=
t all. And the third is a way to declare a function that receives this iden=
tifier/type as a function parameter, but not using regular function paramet=
er syntax.</div><div><br></div><div>I would much rather see this broken dow=
n into individual mechanisms. For example, why does it <i>need</i> to be an=
identifier? If the calling code were:</div><div><br></div><div><div style=
=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187);=
border-style: solid; border-width: 1px; overflow-wrap: break-word;" class=
=3D"prettyprint"><code class=3D"prettyprint"><div class=3D"subprettyprint">=
<span style=3D"color: #000;" class=3D"styled-by-prettify">func</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"=
color: #080;" class=3D"styled-by-prettify">"width"</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> width</span><span style=3D"color:=
#660;" class=3D"styled-by-prettify">);</span></div></code></div><br></div>=
<div></div><div>Would that be so awful? Is the specialized syntax absolutel=
y <i>necessary</i>? Because if we don't need that, then we can get that=
"right now" with C++20's ability to have strings as type par=
ameters:</div><div><br></div><div><div style=3D"background-color: rgb(250, =
250, 250); border-color: rgb(187, 187, 187); border-style: solid; border-wi=
dth: 1px; overflow-wrap: break-word;" class=3D"prettyprint"><code class=3D"=
prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify">func</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">(</span><span style=3D"color: #080;" class=3D"styled-by=
-prettify">"width"</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify">tag</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> width</span><span style=3D"color: #660;" class=3D"styled-by-prettify">);=
</span></div></code></div></div><div><br></div><div>Where `tag` is a UDL wh=
ich converts the given string into a `func_tag` type.</div><div><br></div><=
div>Now sure, when you declare the function, you have to include a bit of c=
ruft. But quite frankly, tagged parameters of this sort should not be so co=
mmon that such cruft appears frequently in code. This is mainly for one-off=
cases like top-left vs. bottom-left rectangle coordinates. For something l=
ike angles, you genuinely want to wrap the number in a real type (since it =
involves units).</div><div><br></div><div>C++20 gets us close enough that w=
e really don't need specialized syntax.<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/de66100c-8d18-45fc-b126-cda0079cfdbb%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/de66100c-8d18-45fc-b126-cda0079cfdbb=
%40isocpp.org</a>.<br />
------=_Part_81516_189590681.1531173166036--
------=_Part_81515_250525056.1531173166036--
.
Author: Thiago Macieira <thiago@macieira.org>
Date: Mon, 09 Jul 2018 16:07:45 -0700
Raw View
On Monday, 9 July 2018 10:59:57 PDT mihailnajdenov@gmail.com wrote:
> On Monday, July 9, 2018 at 5:40:44 PM UTC+3, Thiago Macieira wrote:
> > On Monday, 9 July 2018 05:03:18 PDT mihailn...@gmail.com <javascript:>
> >
> > wrote:
> > > QByteArray(base64: const QByteArray& val);
> > > QByteArray(percentEncoded: const QByteArray& val, char percent = '%')
> > >
> > > QByteArray(parseNumber: int val);
> > > QByteArray(parseNumber: double val);
> >
> > That's why we have "named constructors":
> >
> > QByteArray::fromBase64
> > QByteArray::fromPercentEncoded
> > QByteArray::number
>
> This is exactly the problem trying to solve.
So you're saying you're trying to solve a solved problem?
> It is problem because:
>
> 1. Does not work with any form of generic code - the typesystem does not
> know anything about "named ctors" it knows a ctor and args, that's it. No
> make_ or allocator::construct can ever work.
Explain how one would write generic code passing named arguments / tags. That
is not in your description.
> 2. The class is no longer self explanatory in terms of construction. No
> intellySense and no reasoning reading the ctors in the header alone
Sure it is. Even today, since those named constructors do exist and are found
by the IDE. There's a reason this technique is called "named constructor".
> 3. The normal object creation is circumvented. No new
> QByteArray(fromBase64: data)
Why would you want to do that?
If you're supposed to use pointers, then the named constructor should return
one. If you're supposed to use as values, like QByteArray, then the named
constructors return by value.
> 4. There is still the issue with multiple arguments of the same type or
> simply too many arguments and tricks or conventions must be employed
Subjective answer: if you have this many arguments to a function, it's a poor
API. Redesign.
See https://doc.qt.io/archives/qq/qq13-apis.html#theconveniencetrap
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Software Architect - Intel Open Source Technology Center
--
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/61288208.unFtQxsGbn%40tjmaciei-mobl1.
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Mon, 9 Jul 2018 16:44:33 -0700 (PDT)
Raw View
------=_Part_112969_945258748.1531179874038
Content-Type: multipart/alternative;
boundary="----=_Part_112970_767523446.1531179874039"
------=_Part_112970_767523446.1531179874039
Content-Type: text/plain; charset="UTF-8"
On Monday, July 9, 2018 at 7:07:52 PM UTC-4, Thiago Macieira wrote:
>
> On Monday, 9 July 2018 10:59:57 PDT mihailn...@gmail.com <javascript:>
> wrote:
> > On Monday, July 9, 2018 at 5:40:44 PM UTC+3, Thiago Macieira wrote:
> > > On Monday, 9 July 2018 05:03:18 PDT mihailn...@gmail.com
> <javascript:>
> > >
> > > wrote:
> > > > QByteArray(base64: const QByteArray& val);
> > > > QByteArray(percentEncoded: const QByteArray& val, char percent =
> '%')
> > > >
> > > > QByteArray(parseNumber: int val);
> > > > QByteArray(parseNumber: double val);
> > >
> > > That's why we have "named constructors":
> > >
> > > QByteArray::fromBase64
> > > QByteArray::fromPercentEncoded
> > > QByteArray::number
> >
> > This is exactly the problem trying to solve.
>
> So you're saying you're trying to solve a solved problem?
>
No, he's saying that just because you call them "constructors" doesn't make
them actually work like constructors. They're still regular functions, no
matter what you call them.
He wants to have similar effects, but with *actual* constructors.
> It is problem because:
> >
> > 1. Does not work with any form of generic code - the typesystem does
> not
> > know anything about "named ctors" it knows a ctor and args, that's
> it. No
> > make_ or allocator::construct can ever work.
>
> Explain how one would write generic code passing named arguments / tags.
> That
> is not in your description.
>
Because the named tags are values. They are additional parameters, defined
using a specialized short-hand syntax.
That is, `void func(width: int i)` is the same function as `void
func(func_tag<"width">, int);`. Similarly, the expression `func(width: i);`
is exactly identical to `func(func_tag<"width">{}, i);`.
> 2. The class is no longer self explanatory in terms of construction.
> No
> > intellySense and no reasoning reading the ctors in the header alone
>
> Sure it is. Even today, since those named constructors do exist and are
> found
> by the IDE. There's a reason this technique is called "named constructor".
>
I think he's talking about what the IDE spits out when you do `Typename(`.
That the IDE can find them at all isn't nearly as important as whether the
IDE can find them when you're trying to create an object of that type.
That being said, if you're resorting to named constructors, the right
answer is to remove all *unnamed* constructors (besides copy/move and
*maybe* default). That way, the IDE's failure to return a useful set of
constructors suggests that you should look elsewhere.
> 3. The normal object creation is circumvented. No new
> > QByteArray(fromBase64: data)
>
> Why would you want to do that?
>
> If you're supposed to use pointers, then the named constructor should
> return
> one. If you're supposed to use as values, like QByteArray, then the named
> constructors return by value.
>
"Supposed to use"? Who is the maker of the library to tell me how I'm
supposed to allocate my objects? If I want to make a QByteArray on the
heap, why should they even be involved in that decision?
This is a big part of why we have guaranteed elision now. So that `new
auto(QByteArray::fromBase64(...))` can be just as efficient as `new
QByteArray(...)`.
> 4. There is still the issue with multiple arguments of the same type
> or
> > simply too many arguments and tricks or conventions must be employed
>
> Subjective answer: if you have this many arguments to a function, it's a
> poor
> API. Redesign.
>
> See https://doc.qt.io/archives/qq/qq13-apis.html#theconveniencetrap
>
>
How many arguments does it take before this becomes an issue? His example
with rectangles is pretty compelling; people are always getting things like
that wrong unless they look it up. And that function has 2 parameters.
Two-stage construction has the downside of being something you can't do in
an expression. And there are advantages to being able to do things in an
expression rather than having to create a stack variable and make a bunch
of function calls.
Furthermore, objects with immutable state of this sort are a useful end
unto themselves. Sure, for a GUI, making the state of a GUI element fixed
isn't useful. But for many systems, being able to do that work up-front and
knowing that it will never change is useful. That can only really work if
you have a single place where that object gets generated.
In those cases, it's probably best to bundle them into some kind of struct
and pass them that way. You can even give them default values via default
member initializers. Plus, with C++20 designated initializers, you can even
get the effect of named parameters.
--
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/c0e154f0-ae88-4cf2-ad3d-9c988874bb3e%40isocpp.org.
------=_Part_112970_767523446.1531179874039
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Monday, July 9, 2018 at 7:07:52 PM UTC-4, Thiago Maciei=
ra wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: =
0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">On Monday, 9 July 201=
8 10:59:57 PDT <a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mai=
lto=3D"qGGf6uroBQAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D'javas=
cript:';return true;" onclick=3D"this.href=3D'javascript:';retu=
rn true;">mihailn...@gmail.com</a> wrote:
<br>> On Monday, July 9, 2018 at 5:40:44 PM UTC+3, Thiago Macieira wrote=
:
<br>> > On Monday, 9 July 2018 05:03:18 PDT <a>mihailn...@gmail.com</=
a> <javascript:>
<br>> >=20
<br>> > wrote:
<br>> > > QByteArray(base64: const QByteArray& val);
<br>> > > QByteArray(percentEncoded: const QByteArray& val, ch=
ar percent =3D '%')
<br>> > >=20
<br>> > > QByteArray(parseNumber: int val);
<br>> > > QByteArray(parseNumber: double val);
<br>> >=20
<br>> > That's why we have "named constructors":
<br>> >=20
<br>> > QByteArray::fromBase64
<br>> > QByteArray::fromPercentEncoded
<br>> > QByteArray::number
<br>>=20
<br>> This is exactly the problem trying to solve.
<br>
<br>So you're saying you're trying to solve a solved problem?
<br></blockquote><div><br></div><div>No, he's saying that just because =
you call them "constructors" doesn't make them actually work =
like constructors. They're still regular functions, no matter what you =
call them.</div><div><br></div><div>He wants to have similar effects, but w=
ith <i>actual</i> constructors.<br></div><div><br></div><blockquote class=
=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #cc=
c solid;padding-left: 1ex;">
> It is problem because:
<br>>=20
<br>> =C2=A0 =C2=A01. Does not work with any form of generic code - the =
typesystem does not
<br>> =C2=A0 =C2=A0know anything about "named ctors" it knows =
a ctor and args, that's it. No
<br>> make_ or allocator::construct =C2=A0can ever work.
<br>
<br>Explain how one would write generic code passing named arguments / tags=
.. That=20
<br>is not in your description.
<br></blockquote><div><br></div><div>Because the named tags are values. The=
y are additional parameters, defined using a specialized short-hand syntax.=
</div><div><br></div><div>That is, `void func(width: int i)` is the same fu=
nction as `void func(func_tag<"width">, int);`. Similarly, =
the expression `func(width: i);` is exactly identical to `func(func_tag<=
"width">{}, i);`.<br></div><div><br></div><blockquote class=3D=
"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc s=
olid;padding-left: 1ex;">
> =C2=A0 =C2=A02. The class is no longer self explanatory in terms of co=
nstruction. No
<br>> =C2=A0 =C2=A0intellySense and no reasoning reading the ctors in th=
e header alone
<br>
<br>Sure it is. Even today, since those named constructors do exist and are=
found=20
<br>by the IDE. There's a reason this technique is called "named c=
onstructor".<br></blockquote><div><br></div><div>I think he's talk=
ing about what the IDE spits out when you do `Typename(`. That the IDE can =
find them at all isn't nearly as important as whether the IDE can find =
them when you're trying to create an object of that type.</div><div><br=
></div><div>That being said, if you're resorting to named constructors,=
the right answer is to remove all <i>unnamed</i> constructors (besides cop=
y/move and <i>maybe</i> default). That way, the IDE's failure to return=
a useful set of constructors suggests that you should look elsewhere.<br><=
/div><div><br></div><blockquote class=3D"gmail_quote" style=3D"margin: 0;ma=
rgin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">
> =C2=A0 =C2=A03. The normal object creation is circumvented. No new
<br>> QByteArray(fromBase64: data)
<br>
<br>Why would you want to do that?
<br>
<br>If you're supposed to use pointers, then the named constructor shou=
ld return=20
<br>one. If you're supposed to use as values, like QByteArray, then the=
named=20
<br>constructors return by value.
<br></blockquote><div><br></div><div>"Supposed to use"? Who is th=
e maker of the library to tell me how I'm supposed to allocate my objec=
ts? If I want to make a QByteArray on the heap, why should they even be inv=
olved in that decision?</div><div><br></div><div>This is a big part of why =
we have guaranteed elision now. So that `new auto(QByteArray::fromBase64(..=
..))` can be just as efficient as `new QByteArray(...)`.</div><div><br></div=
><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;bo=
rder-left: 1px #ccc solid;padding-left: 1ex;">
> =C2=A0 =C2=A04. There is still the issue with multiple arguments of th=
e same type or
<br>> =C2=A0 =C2=A0simply too many arguments and tricks or conventions m=
ust be employed
<br>
<br>Subjective answer: if you have this many arguments to a function, it=
9;s a poor=20
<br>API. Redesign.
<br>
<br>See <a href=3D"https://doc.qt.io/archives/qq/qq13-apis.html#theconvenie=
ncetrap" target=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D'=
;https://www.google.com/url?q\x3dhttps%3A%2F%2Fdoc.qt.io%2Farchives%2Fqq%2F=
qq13-apis.html%23theconveniencetrap\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjC=
NHFENJ2ZmboWlL1sBJpS32x-AgA7A';return true;" onclick=3D"this.href=3D=
9;https://www.google.com/url?q\x3dhttps%3A%2F%2Fdoc.qt.io%2Farchives%2Fqq%2=
Fqq13-apis.html%23theconveniencetrap\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQj=
CNHFENJ2ZmboWlL1sBJpS32x-AgA7A';return true;">https://doc.qt.io/archive=
s/qq/<wbr>qq13-apis.html#<wbr>theconveniencetrap</a>
<br>
<br></blockquote><div><br></div><div>How many arguments does it take before=
this becomes an issue? His example with rectangles is pretty compelling; p=
eople are always getting things like that wrong unless they look it up. And=
that function has 2 parameters.<br></div><div><br></div><div>Two-stage con=
struction has the downside of being something you can't do in an expres=
sion. And there are advantages to being able to do things in an expression =
rather than having to create a stack variable and make a bunch of function =
calls.</div><div><br></div><div>Furthermore, objects with immutable state o=
f this sort are a useful end unto themselves. Sure, for a GUI, making the s=
tate of a GUI element fixed isn't useful. But for many systems, being a=
ble to do that work up-front and knowing that it will never change is usefu=
l. That can only really work if you have a single place where that object g=
ets generated.<br></div><div><br></div><div>In those cases, it's probab=
ly best to bundle them into some kind of struct and pass them that way. You=
can even give them default values via default member initializers. Plus, w=
ith C++20 designated initializers, you can even get the effect of named par=
ameters.</div><div><br></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/c0e154f0-ae88-4cf2-ad3d-9c988874bb3e%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/c0e154f0-ae88-4cf2-ad3d-9c988874bb3e=
%40isocpp.org</a>.<br />
------=_Part_112970_767523446.1531179874039--
------=_Part_112969_945258748.1531179874038--
.
Author: Thiago Macieira <thiago@macieira.org>
Date: Mon, 09 Jul 2018 19:43:22 -0700
Raw View
On Monday, 9 July 2018 16:44:33 PDT Nicol Bolas wrote:
> > So you're saying you're trying to solve a solved problem?
>
> No, he's saying that just because you call them "constructors" doesn't make
> them actually work like constructors. They're still regular functions, no
> matter what you call them.
>
> He wants to have similar effects, but with *actual* constructors.
Why? Give the motivation of why you need this in constructors specifically.
> > Explain how one would write generic code passing named arguments / tags.
> > That
> > is not in your description.
>
> Because the named tags are values. They are additional parameters, defined
> using a specialized short-hand syntax.
>
> That is, `void func(width: int i)` is the same function as `void
> func(func_tag<"width">, int);`. Similarly, the expression `func(width: i);`
> is exactly identical to `func(func_tag<"width">{}, i);`.
I'm still missing the syntax of how this extra shorthand parameter gets used
in generic code and passed along to other functions.
> > Sure it is. Even today, since those named constructors do exist and are
> > found
> > by the IDE. There's a reason this technique is called "named constructor".
>
> I think he's talking about what the IDE spits out when you do `Typename(`.
> That the IDE can find them at all isn't nearly as important as whether the
> IDE can find them when you're trying to create an object of that type.
Sure, but my point is that we're not far from that yet. I'm just asking for
strong motivation and I'm not convinced by the arguments so far.
> > If you're supposed to use pointers, then the named constructor should
> > return
> > one. If you're supposed to use as values, like QByteArray, then the named
> > constructors return by value.
>
> "Supposed to use"? Who is the maker of the library to tell me how I'm
> supposed to allocate my objects? If I want to make a QByteArray on the
> heap, why should they even be involved in that decision?
You can generally slot classes into two categories, with exceptions:
1) "object-like": non-copyable, sometimes moveable, managed by a pointer or a
handler class. Therefore, usually used with "new" or equivalent.
2) "value-like": copyable and moveable, swappable, managed directly, passed by
value or by const-reference. In other words, managed like a primitive (like
int). Therefore, seldom "new"ed.
QByteArray, like std::vector and all other Qt and Standard Library containers,
is of the latter type.
> This is a big part of why we have guaranteed elision now. So that `new
> auto(QByteArray::fromBase64(...))` can be just as efficient as `new
> QByteArray(...)`.
Indeed.
> > Subjective answer: if you have this many arguments to a function, it's a
> > poor
> > API. Redesign.
> >
> > See https://doc.qt.io/archives/qq/qq13-apis.html#theconveniencetrap
>
> How many arguments does it take before this becomes an issue? His example
> with rectangles is pretty compelling; people are always getting things like
> that wrong unless they look it up. And that function has 2 parameters.
It's subjective.
Though this is circular logic: we have to have few arguments because we we
don't have named arguments. If we did, we could have many more and still keep
legibility of the code to high standards.
> Two-stage construction has the downside of being something you can't do in
> an expression. And there are advantages to being able to do things in an
> expression rather than having to create a stack variable and make a bunch
> of function calls.
You can use a lambda that is immediately evaluated.
widget.setRect([] {
QRect r; r.setTopRight(0, 0); r.setSize(10, 10); return r; }());
Though this goes against my argument of clean code.
> In those cases, it's probably best to bundle them into some kind of struct
> and pass them that way. You can even give them default values via default
> member initializers. Plus, with C++20 designated initializers, you can even
> get the effect of named parameters.
Good point too.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Software Architect - Intel Open Source Technology Center
--
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/1639422.PRPes756Hv%40tjmaciei-mobl1.
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Mon, 9 Jul 2018 23:19:24 -0700 (PDT)
Raw View
------=_Part_116266_1009147766.1531203564548
Content-Type: multipart/alternative;
boundary="----=_Part_116267_85656960.1531203564549"
------=_Part_116267_85656960.1531203564549
Content-Type: text/plain; charset="UTF-8"
On Monday, July 9, 2018 at 11:59:46 PM UTC-4, Thiago Macieira wrote:
>
> On Monday, 9 July 2018 16:44:33 PDT Nicol Bolas wrote:
> > > So you're saying you're trying to solve a solved problem?
> >
> > No, he's saying that just because you call them "constructors" doesn't
> make
> > them actually work like constructors. They're still regular functions,
> no
> > matter what you call them.
> >
> > He wants to have similar effects, but with *actual* constructors.
>
> Why? Give the motivation of why you need this in constructors specifically.
>
That's like asking why we need to have constructors at all. Constructing an
object is done with special syntax, through functions that have special
meaning to the C++ object model, and so forth. Alternative means of
creating an object are *by definition* not equivalent to using a
constructor.
When we use reflection to introspect the ways to construct an object, it's
not going to list arbitrary static functions that happen to return an
object of that type. It's not going to enumerate global functions that
return a prvalue of that type. It's going to list *constructors*. Because
constructors are how you create an object.
"Named constructors" are a hack. A useful one, to be sure. But they're
still just a hack.
Now, I don't think it's worth burning syntax for this. Or at the very
least, it shouldn't burn syntax in such a rigid way. The thing that most
concerns me is the fact that it is shorthand for a parameter, but doesn't
look like a parameter. Syntax that directly acknowledges that the tag is a
parameter (by requiring a comma between it and the next parameter) makes
more sense to me than having `:` mean both "turn into tag/tag-type" and
"next parameter". It would also allow you to do things like store a tag in
an `auto` variable and use it later.
> > Explain how one would write generic code passing named arguments /
> tags.
> > > That
> > > is not in your description.
> >
> > Because the named tags are values. They are additional parameters,
> defined
> > using a specialized short-hand syntax.
> >
> > That is, `void func(width: int i)` is the same function as `void
> > func(func_tag<"width">, int);`. Similarly, the expression `func(width:
> i);`
> > is exactly identical to `func(func_tag<"width">{}, i);`.
>
> I'm still missing the syntax of how this extra shorthand parameter gets
> used
> in generic code and passed along to other functions.
>
If you have some type `T` for which the expression `T(width: i)` will
create a `T`, then you can call `make_shared<T>(width: i)`. This works
because (`width:`) in an argument list translates directly to
`func_tag<"width">{},`. So these two expressions are *exactly* equivalent:
make_shared<T>(width: i);
make_shared<T>(func_tag<"width">{}, i);
The same goes at the site of `T`'s constructor. These two are the same
function prototype, spelled different ways:
T(width: int i);
T(func_tag<"width"> /*no name given*/, int i);
So when you do `make_shared<T>(width: i);`, `make_shared` gets two
parameters. The first is an object of type `func_tag<"width">`; the second
is an `int`. `make_shared` passes these two parameters to the constructor
of `T`. And `T(width: int i);` declares a constructor which takes two
parameters.
What he's wanting is shorthand syntax for something you could otherwise do
(in C++20). It's merely an abbreviation.
> > Sure it is. Even today, since those named constructors do exist and are
> > > found
> > > by the IDE. There's a reason this technique is called "named
> constructor".
> >
> > I think he's talking about what the IDE spits out when you do
> `Typename(`.
> > That the IDE can find them at all isn't nearly as important as whether
> the
> > IDE can find them when you're trying to create an object of that type.
>
> Sure, but my point is that we're not far from that yet.
.... we are? Are you suggesting that if a user types `Typename(`, the IDE
should start spitting out the parameter lists for things that aren't actual
constructors for type `Typename`? If so, which functions should it be doing
it for? And why pick those functions and not others?
The problem with relying on idioms like this is that there are a lot of
them and not everyone agrees on what they are.
--
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/24b01af7-8ca5-4a7d-9a1d-04765b32e85c%40isocpp.org.
------=_Part_116267_85656960.1531203564549
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Monday, July 9, 2018 at 11:59:46 PM UTC-4, Thiago Macie=
ira wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left:=
0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">On Monday, 9 July 20=
18 16:44:33 PDT Nicol Bolas wrote:
<br>> > So you're saying you're trying to solve a solved prob=
lem?
<br>>=20
<br>> No, he's saying that just because you call them "construc=
tors" doesn't make
<br>> them actually work like constructors. They're still regular fu=
nctions, no
<br>> matter what you call them.
<br>>=20
<br>> He wants to have similar effects, but with *actual* constructors.
<br>
<br>Why? Give the motivation of why you need this in constructors specifica=
lly.<br></blockquote><div><br></div><div>That's like asking why we need=
to have constructors at all. Constructing an object is done with special s=
yntax, through functions that have special meaning to the C++ object model,=
and so forth. Alternative means of creating an object are <i>by definition=
</i> not equivalent to using a constructor.</div><div><br></div><div>When w=
e use reflection to introspect the ways to construct an object, it's no=
t going to list arbitrary static functions that happen to return an object =
of that type. It's not going to enumerate global functions that return =
a prvalue of that type. It's going to list <i>constructors</i>. Because=
constructors are how you create an object.</div><div><br></div><div>"=
Named constructors" are a hack. A useful one, to be sure. But they'=
;re still just a hack.</div><div><br></div><div>Now, I don't think it&#=
39;s worth burning syntax for this. Or at the very least, it shouldn't =
burn syntax in such a rigid way. The thing that most concerns me is the fac=
t that it is shorthand for a parameter, but doesn't look like a paramet=
er. Syntax that directly acknowledges that the tag is a parameter (by requi=
ring a comma between it and the next parameter) makes more sense to me than=
having `:` mean both "turn into tag/tag-type" and "next par=
ameter". It would also allow you to do things like store a tag in an `=
auto` variable and use it later.<br></div><div><br></div><blockquote class=
=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #cc=
c solid;padding-left: 1ex;">
> > Explain how one would write generic code passing named arguments =
/ tags.
<br>> > That
<br>> > is not in your description.
<br>>=20
<br>> Because the named tags are values. They are additional parameters,=
defined
<br>> using a specialized short-hand syntax.
<br>>=20
<br>> That is, `void func(width: int i)` is the same function as `void
<br>> func(func_tag<"width">, int);`. Similarly, the exp=
ression `func(width: i);`
<br>> is exactly identical to `func(func_tag<"width">{},=
i);`.
<br>
<br>I'm still missing the syntax of how this extra shorthand parameter =
gets used=20
<br>in generic code and passed along to other functions.<br></blockquote><d=
iv><br></div>If you have some type `T` for which the expression `T(width: i=
)` will create a `T`, then you can call `make_shared<T>(width: i)`. T=
his works because (`width:`) in an argument list translates directly to `fu=
nc_tag<"width">{},`. So these two expressions are <i>exactl=
y</i> equivalent:<div><br></div><div style=3D"background-color: rgb(250, 25=
0, 250); border-color: rgb(187, 187, 187); border-style: solid; border-widt=
h: 1px; overflow-wrap: break-word;" class=3D"prettyprint"><code class=3D"pr=
ettyprint"><div class=3D"subprettyprint"><span style=3D"color: #000;" class=
=3D"styled-by-prettify">make_shared</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify"><</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify">T</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">>(</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify">width</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
:</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> i</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">);</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"><br>make_shared</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify"><</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify">T</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">>(</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify">func_tag</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify"><</span><span style=3D"color: #080;" cl=
ass=3D"styled-by-prettify">"width"</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">>{},</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> i</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">);</span></div></code></div><div><br></div><div></d=
iv><div>The same goes at the site of `T`'s constructor. These two are t=
he same function prototype, spelled different ways:</div><div><br></div><di=
v style=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 187=
, 187); border-style: solid; border-width: 1px; overflow-wrap: break-word;"=
class=3D"prettyprint"><code class=3D"prettyprint"><div class=3D"subprettyp=
rint"><span style=3D"color: #000;" class=3D"styled-by-prettify">T</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">width</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">:</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">int</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> i</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">);</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
><br>T</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify">func_tag</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><spa=
n style=3D"color: #080;" class=3D"styled-by-prettify">"width"</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">></span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #800;" class=3D"styled-by-prettify">/*no name given*/</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">int</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> i</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">);</span></div></code></div><div><br></div><div>So =
when you do `make_shared<T>(width: i);`, `make_shared` gets two param=
eters. The first is an object of type `func_tag<"width">`; =
the second is an `int`. `make_shared` passes these two parameters to the co=
nstructor of `T`. And `T(width: int i);` declares a constructor which takes=
two parameters.</div><div><br></div><div>What he's wanting is shorthan=
d syntax for something you could otherwise do (in C++20). It's merely a=
n abbreviation.<br></div><div><br></div><blockquote class=3D"gmail_quote" s=
tyle=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-le=
ft: 1ex;">
> > Sure it is. Even today, since those named constructors do exist a=
nd are
<br>> > found
<br>> > by the IDE. There's a reason this technique is called &qu=
ot;named constructor".
<br>>=20
<br>> I think he's talking about what the IDE spits out when you do =
`Typename(`.
<br>> That the IDE can find them at all isn't nearly as important as=
whether the
<br>> IDE can find them when you're trying to create an object of th=
at type.
<br>
<br>Sure, but my point is that we're not far from that yet.</blockquote=
><div><br></div><div>... we are? Are you suggesting that if a user types `T=
ypename(`, the IDE should start spitting out the parameter lists for things=
that aren't actual constructors for type `Typename`? If so, which func=
tions should it be doing it for? And why pick those functions and not other=
s?</div><div><br></div><div>The problem with relying on idioms like this is=
that there are a lot of them and not everyone agrees on what they are.<br>=
</div><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/24b01af7-8ca5-4a7d-9a1d-04765b32e85c%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/24b01af7-8ca5-4a7d-9a1d-04765b32e85c=
%40isocpp.org</a>.<br />
------=_Part_116267_85656960.1531203564549--
------=_Part_116266_1009147766.1531203564548--
.
Author: mihailnajdenov@gmail.com
Date: Tue, 10 Jul 2018 02:18:22 -0700 (PDT)
Raw View
------=_Part_11454_2009409772.1531214302759
Content-Type: multipart/alternative;
boundary="----=_Part_11455_415142356.1531214302759"
------=_Part_11455_415142356.1531214302759
Content-Type: text/plain; charset="UTF-8"
On Tuesday, July 10, 2018 at 12:52:46 AM UTC+3, Nicol Bolas wrote:
>
> On Monday, July 9, 2018 at 6:00:59 AM UTC-4, mihailn...@gmail.com wrote:
>>
>> Basically we can have beautiful and teachable interfaces and the tag
>> stays as implementation detail.
>>
>
> But it's *not* an "implementation detail".
>
> Can I pass `func` to a `std::function<void(int)>`? I rather suspect not.
> Indeed, overloading aside, what would `&func` return? It would have to be a
> `void(*)(tag_type<"width">, int)`, right? So it's hardly an implementation
> detail; it changes the signature of the function.
>
> This kind of design reminds me of the Coroutines TS: it start with a
> syntax and preferred behavior, then does whatever it takes to make that
> syntax have the preferred behavior. Comparatively, the Core Corotines
> proposal is about providing mechanisms which can be used to implement the
> preferred behavior.
>
> What I mean is this: your proposal is really three related mechanisms. The
> first is a way to convert an identifier into a type. The second is a way to
> pass this identifier/type as a function parameter so that it doesn't look
> like a function parameter at all. And the third is a way to declare a
> function that receives this identifier/type as a function parameter, but
> not using regular function parameter syntax.
>
> I would much rather see this broken down into individual mechanisms. For
> example, why does it *need* to be an identifier? If the calling code were:
>
Once we break things down, we are back at were we started.
>
> func("width", width);
>
> Would that be so awful? Is the specialized syntax absolutely *necessary*?
> Because if we don't need that, then we can get that "right now" with
> C++20's ability to have strings as type parameters:
>
> func("width"tag, width);
>
> Where `tag` is a UDL which converts the given string into a `func_tag`
> type.
>
>
BTW, I am no longer sure we need strings
class width_tag {};
should be enough. Strings will be quite heavy, error prone ("widht") and we
don't really need to parse these in compile time, not to motion any raw tag
will be invisible to the tools, and we want tools to know about the
function as much as possible
Also, don't forget templated labels! std::any, std::variant both use them!
But no matter the syntax, it should be first class citizen (syntax
highlight, auto-completion, improved error report etc ) and must feel
natural:
std::find(begin, end, if: []{ /*...*/ });
std::find(begin, end, if_not: []{ /*...*/ });
@Thiago Notice, we can control 'find' using SFINAE and what not. Naming
things is fine with people (and front-end code) but it is a combo breaker
for generic code
This approach tries to have it both ways
@Richard Notice here will also be plain wrong to have special wrapper types
just to express intend
And yea, it should be possible to decltype(if:) and auto ifn = if_not:;
*Ideally* a func pointer should be the same as the signature - (*)(width:
int) - but initially we could let it be (*)(decltype(width:), int)
Labels are always on global scope - if the name exists it is reused, if not
it not, it is declared.
Namespaces make no sense for labels.
They are never <included> from somewhere, and there is no collision or
ambiguity in them - size: can label size in geometry functions, physics,
clothing, housing, pizza. A label name is its semantics.
That is one of the reasons they *should* be handled by the compiler and be
transparent to the user, a no-brainer.
*Sidenote* on the declaration site the syntax can be case label: in order
to feel we are introducing something -
a new entity (an argument of type label) AND well, it is correct - we
introduce a new case of using the same arguments!
InputIt find( InputIt first, InputIt last, case if: UnaryPredicate p );
But the : instead of comma should say.
Also allowed should be only the least amount of case labels, need to
disambiguate - this will prevent syntax maniacs to label every argument!
In other words fill_n will NOT be allowed to be rewritten in terms of case
labels!
> Now sure, when you declare the function, you have to include a bit of
> cruft. But quite frankly, tagged parameters of this sort should not be so
> common that such cruft appears frequently in code. This is mainly for
> one-off cases like top-left vs. bottom-left rectangle coordinates. For
> something like angles, you genuinely want to wrap the number in a real type
> (since it involves units).
>
> C++20 gets us close enough that we really don't need specialized syntax.
>
It will still be a workaround and no new user will dare to try it. We still
have to teach it as a "convention", a trick.
--
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/ded3cb0a-0128-4d79-b367-3dee64c6e015%40isocpp.org.
------=_Part_11455_415142356.1531214302759
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Tuesday, July 10, 2018 at 12:52:46 AM UTC+3, Ni=
col Bolas 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"lt=
r">On Monday, July 9, 2018 at 6:00:59 AM UTC-4, <a>mihailn...@gmail.com</a>=
wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8e=
x;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div><span =
style=3D"text-align:left;color:rgb(34,34,34);text-transform:none;text-inden=
t:0px;letter-spacing:normal;font-size:13px;font-style:normal;font-variant:n=
ormal;font-weight:400;text-decoration:none;word-spacing:0px;display:inline!=
important;white-space:normal;float:none;background-color:transparent"><font=
face=3D"arial,sans-serif">Basically we can have beautiful and teachable in=
terfaces and the tag stays as implementation detail.</font></span></div></d=
iv></blockquote><div><br></div><div>But it's <i>not</i> an "implem=
entation detail".</div><div><br></div><div>Can I pass `func` to a `std=
::function<void(int)>`? I rather suspect not. Indeed, overloading asi=
de, what would `&func` return? It would have to be a `void(*)(tag_type&=
lt;"width">, int)`, right? So it's hardly an implementatio=
n detail; it changes the signature of the function.</div><div><br></div><di=
v>This kind of design reminds me of the Coroutines TS: it start with a synt=
ax and preferred behavior, then does whatever it takes to make that syntax =
have the preferred behavior. Comparatively, the Core Corotines proposal is =
about providing mechanisms which can be used to implement the preferred beh=
avior.</div><div><br></div><div>What I mean is this: your proposal is reall=
y three related mechanisms. The first is a way to convert an identifier int=
o a type. The second is a way to pass this identifier/type as a function pa=
rameter so that it doesn't look like a function parameter at all. And t=
he third is a way to declare a function that receives this identifier/type =
as a function parameter, but not using regular function parameter syntax.</=
div><div><br></div><div>I would much rather see this broken down into indiv=
idual mechanisms. For example, why does it <i>need</i> to be an identifier?=
If the calling code were:</div></div></blockquote><div><br></div><div>Once=
we break things down, we are back at were we started.<br></div><div>=C2=A0=
</div><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8=
ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div><b=
r></div><div><div style=3D"background-color:rgb(250,250,250);border-color:r=
gb(187,187,187);border-style:solid;border-width:1px"><code><div><span style=
=3D"color:#000">func</span><span style=3D"color:#660">(</span><span style=
=3D"color:#080">"width"</span><span style=3D"color:#660">,</span>=
<span style=3D"color:#000"> width</span><span style=3D"color:#660">);</span=
></div></code></div><br></div><div></div><div>Would that be so awful? Is th=
e specialized syntax absolutely <i>necessary</i>? Because if we don't n=
eed that, then we can get that "right now" with C++20's abili=
ty to have strings as type parameters:</div><div><br></div><div><div style=
=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-=
style:solid;border-width:1px"><code><div><span style=3D"color:#000">func</s=
pan><span style=3D"color:#660">(</span><span style=3D"color:#080">"wid=
th"</span><span style=3D"color:#000">tag</span><span style=3D"color:#6=
60">,</span><span style=3D"color:#000"> width</span><span style=3D"color:#6=
60">);</span></div></code></div></div><div><br></div><div>Where `tag` is a =
UDL which converts the given string into a `func_tag` type.</div><div><br><=
/div></div></blockquote><div><br></div><div>BTW, I am no longer sure we nee=
d strings</div><div><br></div><div><font face=3D"courier new,monospace">cla=
ss width_tag {};</font></div><div><font face=3D"courier new,monospace"><br>=
</font></div><div>should be enough. Strings will be quite heavy, error pron=
e ("widht") and we don't really need to parse these in compil=
e time, not to motion any raw tag will be invisible to the tools, and we wa=
nt tools to know about the function as much as possible</div><div>Also, don=
't forget templated labels! std::any, std::variant both use them!</div>=
<div><br></div><div>But no matter the syntax, it should be first class citi=
zen (syntax highlight, auto-completion, improved error report etc ) and mus=
t feel natural:</div><div><br></div><div><font face=3D"courier new,monospac=
e">std::find(begin, end, if: []{ /*...*/ });</font></div><div><font face=3D=
"courier new,monospace">std::find(begin, end, if_not: []{ /*...*/ });</font=
></div><div><font face=3D"courier new,monospace"></font><br>@Thiago Notice,=
we can control 'find' using SFINAE and what not. Naming things is =
fine with people (and front-end code) but it is a combo breaker for generic=
code</div><div>This approach tries to have it both ways=C2=A0</div><div><b=
r></div><div>@Richard Notice here will also be plain wrong to have special =
wrapper types just to express intend</div><div><br></div><div><br>And yea, =
it should be possible to <font face=3D"courier new,monospace">decltype(if:)=
</font> and<font face=3D"courier new,monospace"> auto ifn =3D if_not:;</fon=
t></div><div><font face=3D"arial,sans-serif"><i>Ideally</i> a func pointer =
should be the same as the signature - <font face=3D"courier new,monospace" =
style=3D"border-bottom-color: rgb(34, 34, 34); border-bottom-style: none; b=
order-bottom-width: 0px; border-image-outset: 0; border-image-repeat: stret=
ch; border-image-slice: 100%; border-image-source: none; border-image-width=
: 1; border-left-color: rgb(34, 34, 34); border-left-style: none; border-le=
ft-width: 0px; border-right-color: rgb(34, 34, 34); border-right-style: non=
e; border-right-width: 0px; border-top-color: rgb(34, 34, 34); border-top-s=
tyle: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; ma=
rgin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; p=
adding-right: 0px; padding-top: 0px;">(*)(width: int)</font></font><font fa=
ce=3D"arial,sans-serif"><font 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-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; margin-bot=
tom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bot=
tom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"> - </fo=
nt>but initially we could let it be </font><font face=3D"courier new,monosp=
ace">(*)(decltype(<span style=3D"display: inline !important; float: none; b=
ackground-color: transparent; color: rgb(34, 34, 34); font-family: courier =
new,monospace; font-size: 13px; font-style: normal; font-variant: normal; f=
ont-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text=
-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-str=
oke-width: 0px; white-space: normal; word-spacing: 0px;">width</span>:), in=
t)</font></div><div><br></div><div><font face=3D"arial,sans-serif">Labels a=
re always on global scope - if the name exists it is reused, if not it not,=
it is declared.=C2=A0</font></div><div><font face=3D"arial,sans-serif">Nam=
espaces make no sense for labels.=C2=A0</font></div><div><font face=3D"aria=
l,sans-serif">They are never <included> from somewhere, and there is =
no collision or ambiguity in them - </font><font face=3D"courier new,monosp=
ace">size: </font><font face=3D"arial,sans-serif">can label size in geometr=
y functions, physics, clothing, housing, pizza. </font><font face=3D"arial,=
sans-serif">A label name is its semantics.=C2=A0</font></div><div><font fac=
e=3D"arial,sans-serif">That is one of the reasons they <i>should</i> be han=
dled by the compiler and be transparent to the user, a no-brainer.=C2=A0</f=
ont></div><div><font face=3D"courier new,monospace"><b></b><i></i><u></u><s=
ub></sub><sup></sup><strike></strike><font face=3D"arial,sans-serif"></font=
><font face=3D"arial,sans-serif"></font><br></font></div><div><b>Sidenote</=
b> on the declaration site the syntax can be<font face=3D"courier new,monos=
pace"> case label:</font> in order to feel we are introducing something - <=
br>a new entity (an argument of type label) AND well, it is correct - we in=
troduce a new case of using the same arguments!</div><div><font face=3D"cou=
rier new,monospace"></font><br></div><div><font face=3D"courier new,monospa=
ce">InputIt find( InputIt first, InputIt last, case if: UnaryPredicate p );=
</font></div><div><font face=3D"courier new,monospace"><br></font></div><di=
v>But the <font face=3D"courier new,monospace">:</font> instead of comma sh=
ould say.=C2=A0</div><div><br>Also allowed should be only the least amount =
of case labels, need to disambiguate - this will prevent syntax maniacs to =
label every argument!</div><div>In other words <font face=3D"courier new,mo=
nospace">fill_n </font>will NOT be allowed to be rewritten in terms of case=
labels!<br></div><div><br></div><div>=C2=A0</div><blockquote class=3D"gmai=
l_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;=
padding-left: 1ex;"><div dir=3D"ltr"><div></div><div>Now sure, when you dec=
lare the function, you have to include a bit of cruft. But quite frankly, t=
agged parameters of this sort should not be so common that such cruft appea=
rs frequently in code. This is mainly for one-off cases like top-left vs. b=
ottom-left rectangle coordinates. For something like angles, you genuinely =
want to wrap the number in a real type (since it involves units).</div><div=
><br></div><div>C++20 gets us close enough that we really don't need sp=
ecialized syntax.<br></div></div></blockquote><div><br></div><div>It will s=
till be a workaround and no new user will dare to try it. We still have to =
teach it as a "convention", a trick.=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/ded3cb0a-0128-4d79-b367-3dee64c6e015%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/ded3cb0a-0128-4d79-b367-3dee64c6e015=
%40isocpp.org</a>.<br />
------=_Part_11455_415142356.1531214302759--
------=_Part_11454_2009409772.1531214302759--
.
Author: Richard Hodges <hodges.r@gmail.com>
Date: Tue, 10 Jul 2018 12:56:43 +0100
Raw View
--0000000000008ea4bb0570a3d363
Content-Type: text/plain; charset="UTF-8"
On Tue, 10 Jul 2018 at 10:18, <mihailnajdenov@gmail.com> wrote:
>
>
> On Tuesday, July 10, 2018 at 12:52:46 AM UTC+3, Nicol Bolas wrote:
>>
>> On Monday, July 9, 2018 at 6:00:59 AM UTC-4, mihailn...@gmail.com wrote:
>>>
>>> Basically we can have beautiful and teachable interfaces and the tag
>>> stays as implementation detail.
>>>
>>
>> But it's *not* an "implementation detail".
>>
>> Can I pass `func` to a `std::function<void(int)>`? I rather suspect not.
>> Indeed, overloading aside, what would `&func` return? It would have to be a
>> `void(*)(tag_type<"width">, int)`, right? So it's hardly an implementation
>> detail; it changes the signature of the function.
>>
>> This kind of design reminds me of the Coroutines TS: it start with a
>> syntax and preferred behavior, then does whatever it takes to make that
>> syntax have the preferred behavior. Comparatively, the Core Corotines
>> proposal is about providing mechanisms which can be used to implement the
>> preferred behavior.
>>
>> What I mean is this: your proposal is really three related mechanisms.
>> The first is a way to convert an identifier into a type. The second is a
>> way to pass this identifier/type as a function parameter so that it doesn't
>> look like a function parameter at all. And the third is a way to declare a
>> function that receives this identifier/type as a function parameter, but
>> not using regular function parameter syntax.
>>
>> I would much rather see this broken down into individual mechanisms. For
>> example, why does it *need* to be an identifier? If the calling code
>> were:
>>
>
> Once we break things down, we are back at were we started.
>
>
>>
>> func("width", width);
>>
>> Would that be so awful? Is the specialized syntax absolutely *necessary*?
>> Because if we don't need that, then we can get that "right now" with
>> C++20's ability to have strings as type parameters:
>>
>> func("width"tag, width);
>>
>> Where `tag` is a UDL which converts the given string into a `func_tag`
>> type.
>>
>>
> BTW, I am no longer sure we need strings
>
> class width_tag {};
>
> should be enough. Strings will be quite heavy, error prone ("widht") and
> we don't really need to parse these in compile time, not to motion any raw
> tag will be invisible to the tools, and we want tools to know about the
> function as much as possible
> Also, don't forget templated labels! std::any, std::variant both use them!
>
> But no matter the syntax, it should be first class citizen (syntax
> highlight, auto-completion, improved error report etc ) and must feel
> natural:
>
> std::find(begin, end, if: []{ /*...*/ });
> std::find(begin, end, if_not: []{ /*...*/ });
>
> @Thiago Notice, we can control 'find' using SFINAE and what not. Naming
> things is fine with people (and front-end code) but it is a combo breaker
> for generic code
> This approach tries to have it both ways
>
> @Richard Notice here will also be plain wrong to have special wrapper
> types just to express intend
>
>
Why would this be wrong?
auto condition = [](auto&&x) { /* ... */ };
std::find(first, last, if_not(condition));
where if_not is defined as:
template<class Pred>
struct if_not {
if_not(Pred pred) : pred_(pred) {}
bool operator()(X&&x) const { return !pred_(std::forward<X>(x)); }
Pred pred_;
};
>
> And yea, it should be possible to decltype(if:) and auto ifn = if_not:;
> *Ideally* a func pointer should be the same as the signature - (*)(width:
> int) - but initially we could let it be (*)(decltype(width:), int)
>
> Labels are always on global scope - if the name exists it is reused, if
> not it not, it is declared.
> Namespaces make no sense for labels.
> They are never <included> from somewhere, and there is no collision or
> ambiguity in them - size: can label size in geometry functions, physics,
> clothing, housing, pizza. A label name is its semantics.
> That is one of the reasons they *should* be handled by the compiler and
> be transparent to the user, a no-brainer.
>
> *Sidenote* on the declaration site the syntax can be case label: in order
> to feel we are introducing something -
> a new entity (an argument of type label) AND well, it is correct - we
> introduce a new case of using the same arguments!
>
> InputIt find( InputIt first, InputIt last, case if: UnaryPredicate p );
>
> But the : instead of comma should say.
>
> Also allowed should be only the least amount of case labels, need to
> disambiguate - this will prevent syntax maniacs to label every argument!
> In other words fill_n will NOT be allowed to be rewritten in terms of
> case labels!
>
>
>
>> Now sure, when you declare the function, you have to include a bit of
>> cruft. But quite frankly, tagged parameters of this sort should not be so
>> common that such cruft appears frequently in code. This is mainly for
>> one-off cases like top-left vs. bottom-left rectangle coordinates. For
>> something like angles, you genuinely want to wrap the number in a real type
>> (since it involves units).
>>
>> C++20 gets us close enough that we really don't need specialized syntax.
>>
>
> It will still be a workaround and no new user will dare to try it. We
> still have to teach it as a "convention", a trick.
>
> --
> 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/ded3cb0a-0128-4d79-b367-3dee64c6e015%40isocpp.org
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/ded3cb0a-0128-4d79-b367-3dee64c6e015%40isocpp.org?utm_medium=email&utm_source=footer>
> .
>
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALvx3hadGXsKyRRfzuuVAuX91KxTOqEw6%2BaDMm7fv38hiAfGsQ%40mail.gmail.com.
--0000000000008ea4bb0570a3d363
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br><div class=3D"gmail_quote"><div dir=3D"ltr">On Tue=
, 10 Jul 2018 at 10:18, <<a href=3D"mailto:mihailnajdenov@gmail.com">mih=
ailnajdenov@gmail.com</a>> wrote:<br></div><blockquote class=3D"gmail_qu=
ote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex=
"><div dir=3D"ltr"><br><br>On Tuesday, July 10, 2018 at 12:52:46 AM UTC+3, =
Nicol Bolas 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"ltr">=
On Monday, July 9, 2018 at 6:00:59 AM UTC-4, <a>mihailn...@gmail.com</a> wr=
ote:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;b=
order-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div><span sty=
le=3D"text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0=
px;letter-spacing:normal;font-size:13px;font-style:normal;font-variant:norm=
al;font-weight:400;text-decoration:none;word-spacing:0px;display:inline!imp=
ortant;white-space:normal;float:none;background-color:transparent"><font fa=
ce=3D"arial,sans-serif">Basically we can have beautiful and teachable inter=
faces and the tag stays as implementation detail.</font></span></div></div>=
</blockquote><div><br></div><div>But it's <i>not</i> an "implement=
ation detail".</div><div><br></div><div>Can I pass `func` to a `std::f=
unction<void(int)>`? I rather suspect not. Indeed, overloading aside,=
what would `&func` return? It would have to be a `void(*)(tag_type<=
"width">, int)`, right? So it's hardly an implementation d=
etail; it changes the signature of the function.</div><div><br></div><div>T=
his kind of design reminds me of the Coroutines TS: it start with a syntax =
and preferred behavior, then does whatever it takes to make that syntax hav=
e the preferred behavior. Comparatively, the Core Corotines proposal is abo=
ut providing mechanisms which can be used to implement the preferred behavi=
or.</div><div><br></div><div>What I mean is this: your proposal is really t=
hree related mechanisms. The first is a way to convert an identifier into a=
type. The second is a way to pass this identifier/type as a function param=
eter so that it doesn't look like a function parameter at all. And the =
third is a way to declare a function that receives this identifier/type as =
a function parameter, but not using regular function parameter syntax.</div=
><div><br></div><div>I would much rather see this broken down into individu=
al mechanisms. For example, why does it <i>need</i> to be an identifier? If=
the calling code were:</div></div></blockquote><div><br></div><div>Once we=
break things down, we are back at were we started.<br></div><div>=C2=A0</d=
iv><blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;bo=
rder-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div><br></div>=
<div><div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,1=
87,187);border-style:solid;border-width:1px"><code><div><span style=3D"colo=
r:#000">func</span><span style=3D"color:#660">(</span><span style=3D"color:=
#080">"width"</span><span style=3D"color:#660">,</span><span styl=
e=3D"color:#000"> width</span><span style=3D"color:#660">);</span></div></c=
ode></div><br></div><div></div><div>Would that be so awful? Is the speciali=
zed syntax absolutely <i>necessary</i>? Because if we don't need that, =
then we can get that "right now" with C++20's ability to have=
strings as type parameters:</div><div><br></div><div><div style=3D"backgro=
und-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid=
;border-width:1px"><code><div><span style=3D"color:#000">func</span><span s=
tyle=3D"color:#660">(</span><span style=3D"color:#080">"width"</s=
pan><span style=3D"color:#000">tag</span><span style=3D"color:#660">,</span=
><span style=3D"color:#000"> width</span><span style=3D"color:#660">);</spa=
n></div></code></div></div><div><br></div><div>Where `tag` is a UDL which c=
onverts the given string into a `func_tag` type.</div><div><br></div></div>=
</blockquote><div><br></div><div>BTW, I am no longer sure we need strings</=
div><div><br></div><div><font face=3D"courier new,monospace">class width_ta=
g {};</font></div><div><font face=3D"courier new,monospace"><br></font></di=
v><div>should be enough. Strings will be quite heavy, error prone ("wi=
dht") and we don't really need to parse these in compile time, not=
to motion any raw tag will be invisible to the tools, and we want tools to=
know about the function as much as possible</div><div>Also, don't forg=
et templated labels! std::any, std::variant both use them!</div><div><br></=
div><div>But no matter the syntax, it should be first class citizen (syntax=
highlight, auto-completion, improved error report etc ) and must feel natu=
ral:</div><div><br></div><div><font face=3D"courier new,monospace">std::fin=
d(begin, end, if: []{ /*...*/ });</font></div><div><font face=3D"courier ne=
w,monospace">std::find(begin, end, if_not: []{ /*...*/ });</font></div></di=
v></blockquote><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex=
;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div><br>@Th=
iago Notice, we can control 'find' using SFINAE and what not. Namin=
g things is fine with people (and front-end code) but it is a combo breaker=
for generic code</div><div>This approach tries to have it both ways=C2=A0<=
/div><div><br></div><div>@Richard Notice here will also be plain wrong to h=
ave special wrapper types just to express intend</div><div><br></div></div>=
</blockquote><div><br></div><div><div style=3D"background-color:rgb(255,255=
,255);text-decoration-style:initial;text-decoration-color:initial">Why woul=
d this be wrong?</div><div style=3D"background-color:rgb(255,255,255);text-=
decoration-style:initial;text-decoration-color:initial"><br></div><div styl=
e=3D"background-color:rgb(255,255,255);text-decoration-style:initial;text-d=
ecoration-color:initial"><font face=3D"monospace, monospace">auto condition=
=3D [](auto&&x) { /* ... */ };</font></div><div style=3D"backgroun=
d-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-colo=
r:initial"><font face=3D"monospace, monospace">std::find(first, last, if_no=
t(condition));</font></div><div style=3D"background-color:rgb(255,255,255);=
text-decoration-style:initial;text-decoration-color:initial"><br></div><div=
style=3D"background-color:rgb(255,255,255);text-decoration-style:initial;t=
ext-decoration-color:initial">where if_not is defined as:</div><div style=
=3D"background-color:rgb(255,255,255);text-decoration-style:initial;text-de=
coration-color:initial"><br></div><div style=3D"background-color:rgb(255,25=
5,255);text-decoration-style:initial;text-decoration-color:initial"><font f=
ace=3D"monospace, monospace">template<class Pred></font></div><div st=
yle=3D"background-color:rgb(255,255,255);text-decoration-style:initial;text=
-decoration-color:initial"><font face=3D"monospace, monospace">struct if_no=
t {</font></div><div style=3D"background-color:rgb(255,255,255);text-decora=
tion-style:initial;text-decoration-color:initial"><font face=3D"monospace, =
monospace">=C2=A0 if_not(Pred pred) : pred_(pred) {}</font></div><div style=
=3D"background-color:rgb(255,255,255);text-decoration-style:initial;text-de=
coration-color:initial"><font face=3D"monospace, monospace">=C2=A0 bool ope=
rator()(X&&x) const { return !pred_(std::forward<X>(x)); }</f=
ont></div><div style=3D"background-color:rgb(255,255,255);text-decoration-s=
tyle:initial;text-decoration-color:initial"><font face=3D"monospace, monosp=
ace">=C2=A0 Pred pred_;</font></div><div style=3D"background-color:rgb(255,=
255,255);text-decoration-style:initial;text-decoration-color:initial"><font=
face=3D"monospace, monospace">};</font></div><div>=C2=A0<br></div></div><b=
lockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px =
#ccc solid;padding-left:1ex"><div dir=3D"ltr"><div></div><div><br>And yea, =
it should be possible to <font face=3D"courier new,monospace">decltype(if:)=
</font> and<font face=3D"courier new,monospace"> auto ifn =3D if_not:;</fon=
t></div><div><font face=3D"arial,sans-serif"><i>Ideally</i> a func pointer =
should be the same as the signature - <font face=3D"courier new,monospace" =
style=3D"border-bottom-color:rgb(34,34,34);border-bottom-style:none;border-=
bottom-width:0px;border-left-color:rgb(34,34,34);border-left-style:none;bor=
der-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;margin-bottom:0px;margin-left:0px;margin-right:0px;m=
argin-top:0px;padding-bottom:0px;padding-left:0px;padding-right:0px;padding=
-top:0px">(*)(width: int)</font></font><font face=3D"arial,sans-serif"><fon=
t style=3D"border-bottom-color:rgb(34,34,34);border-bottom-style:none;borde=
r-bottom-width:0px;border-left-color:rgb(34,34,34);border-left-style:none;b=
order-left-width:0px;border-right-color:rgb(34,34,34);border-right-style:no=
ne;border-right-width:0px;border-top-color:rgb(34,34,34);border-top-style:n=
one;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;paddi=
ng-top:0px"> - </font>but initially we could let it be </font><font face=3D=
"courier new,monospace">(*)(decltype(<span style=3D"display:inline!importan=
t;float:none;background-color:transparent;color:rgb(34,34,34);font-family:c=
ourier new,monospace;font-size:13px;font-style:normal;font-variant:normal;f=
ont-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;t=
ext-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">wid=
th</span>:), int)</font></div><div><br></div><div><font face=3D"arial,sans-=
serif">Labels are always on global scope - if the name exists it is reused,=
if not it not, it is declared.=C2=A0</font></div><div><font face=3D"arial,=
sans-serif">Namespaces make no sense for labels.=C2=A0</font></div><div><fo=
nt face=3D"arial,sans-serif">They are never <included> from somewhere=
, and there is no collision or ambiguity in them - </font><font face=3D"cou=
rier new,monospace">size: </font><font face=3D"arial,sans-serif">can label =
size in geometry functions, physics, clothing, housing, pizza. </font><font=
face=3D"arial,sans-serif">A label name is its semantics.=C2=A0</font></div=
><div><font face=3D"arial,sans-serif">That is one of the reasons they <i>sh=
ould</i> be handled by the compiler and be transparent to the user, a no-br=
ainer.=C2=A0</font></div><div><font face=3D"courier new,monospace"><b></b><=
i></i><u></u><sub></sub><sup></sup><strike></strike><font face=3D"arial,san=
s-serif"></font><font face=3D"arial,sans-serif"></font><br></font></div><di=
v><b>Sidenote</b> on the declaration site the syntax can be<font face=3D"co=
urier new,monospace"> case label:</font> in order to feel we are introducin=
g something - <br>a new entity (an argument of type label) AND well, it is =
correct - we introduce a new case of using the same arguments!</div><div><f=
ont face=3D"courier new,monospace"></font><br></div><div><font face=3D"cour=
ier new,monospace">InputIt find( InputIt first, InputIt last, case if: Unar=
yPredicate p );</font></div><div><font face=3D"courier new,monospace"><br><=
/font></div><div>But the <font face=3D"courier new,monospace">:</font> inst=
ead of comma should say.=C2=A0</div><div><br>Also allowed should be only th=
e least amount of case labels, need to disambiguate - this will prevent syn=
tax maniacs to label every argument!</div><div>In other words <font face=3D=
"courier new,monospace">fill_n </font>will NOT be allowed to be rewritten i=
n terms of case labels!<br></div><div><br></div><div>=C2=A0</div><blockquot=
e 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></div><div>Now sure, wh=
en you declare the function, you have to include a bit of cruft. But quite =
frankly, tagged parameters of this sort should not be so common that such c=
ruft appears frequently in code. This is mainly for one-off cases like top-=
left vs. bottom-left rectangle coordinates. For something like angles, you =
genuinely want to wrap the number in a real type (since it involves units).=
</div><div><br></div><div>C++20 gets us close enough that we really don'=
;t need specialized syntax.<br></div></div></blockquote><div><br></div><div=
>It will still be a workaround and no new user will dare to try it. We stil=
l have to teach it as a "convention", a trick.=C2=A0</div><div><b=
r></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" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/ded3cb0a-0128-4d79-b367-3dee64c6e015%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter" target=3D"_blank">=
https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/ded3cb0a-0128-=
4d79-b367-3dee64c6e015%40isocpp.org</a>.<br>
</blockquote></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/CALvx3hadGXsKyRRfzuuVAuX91KxTOqEw6%2B=
aDMm7fv38hiAfGsQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CALvx3hadGXsKyR=
RfzuuVAuX91KxTOqEw6%2BaDMm7fv38hiAfGsQ%40mail.gmail.com</a>.<br />
--0000000000008ea4bb0570a3d363--
.
Author: mihailnajdenov@gmail.com
Date: Tue, 10 Jul 2018 06:11:58 -0700 (PDT)
Raw View
------=_Part_118711_1908680244.1531228318989
Content-Type: multipart/alternative;
boundary="----=_Part_118712_1847815727.1531228318990"
------=_Part_118712_1847815727.1531228318990
Content-Type: text/plain; charset="UTF-8"
On Tuesday, July 10, 2018 at 2:56:56 PM UTC+3, Richard Hodges wrote:
>
>
>
> On Tue, 10 Jul 2018 at 10:18, <mihailn...@gmail.com <javascript:>> wrote:
>
>>
>>
>> On Tuesday, July 10, 2018 at 12:52:46 AM UTC+3, Nicol Bolas wrote:
>>>
>>> On Monday, July 9, 2018 at 6:00:59 AM UTC-4, mihailn...@gmail.com wrote:
>>>>
>>>> Basically we can have beautiful and teachable interfaces and the tag
>>>> stays as implementation detail.
>>>>
>>>
>>> But it's *not* an "implementation detail".
>>>
>>> Can I pass `func` to a `std::function<void(int)>`? I rather suspect not.
>>> Indeed, overloading aside, what would `&func` return? It would have to be a
>>> `void(*)(tag_type<"width">, int)`, right? So it's hardly an implementation
>>> detail; it changes the signature of the function.
>>>
>>> This kind of design reminds me of the Coroutines TS: it start with a
>>> syntax and preferred behavior, then does whatever it takes to make that
>>> syntax have the preferred behavior. Comparatively, the Core Corotines
>>> proposal is about providing mechanisms which can be used to implement the
>>> preferred behavior.
>>>
>>> What I mean is this: your proposal is really three related mechanisms.
>>> The first is a way to convert an identifier into a type. The second is a
>>> way to pass this identifier/type as a function parameter so that it doesn't
>>> look like a function parameter at all. And the third is a way to declare a
>>> function that receives this identifier/type as a function parameter, but
>>> not using regular function parameter syntax.
>>>
>>> I would much rather see this broken down into individual mechanisms. For
>>> example, why does it *need* to be an identifier? If the calling code
>>> were:
>>>
>>
>> Once we break things down, we are back at were we started.
>>
>>
>>>
>>> func("width", width);
>>>
>>> Would that be so awful? Is the specialized syntax absolutely *necessary*?
>>> Because if we don't need that, then we can get that "right now" with
>>> C++20's ability to have strings as type parameters:
>>>
>>> func("width"tag, width);
>>>
>>> Where `tag` is a UDL which converts the given string into a `func_tag`
>>> type.
>>>
>>>
>> BTW, I am no longer sure we need strings
>>
>> class width_tag {};
>>
>> should be enough. Strings will be quite heavy, error prone ("widht") and
>> we don't really need to parse these in compile time, not to motion any raw
>> tag will be invisible to the tools, and we want tools to know about the
>> function as much as possible
>> Also, don't forget templated labels! std::any, std::variant both use them!
>>
>> But no matter the syntax, it should be first class citizen (syntax
>> highlight, auto-completion, improved error report etc ) and must feel
>> natural:
>>
>> std::find(begin, end, if: []{ /*...*/ });
>> std::find(begin, end, if_not: []{ /*...*/ });
>>
>
>> @Thiago Notice, we can control 'find' using SFINAE and what not. Naming
>> things is fine with people (and front-end code) but it is a combo breaker
>> for generic code
>> This approach tries to have it both ways
>>
>> @Richard Notice here will also be plain wrong to have special wrapper
>> types just to express intend
>>
>>
> Why would this be wrong?
>
> auto condition = [](auto&&x) { /* ... */ };
> std::find(first, last, if_not(condition));
>
> where if_not is defined as:
>
> template<class Pred>
> struct if_not {
> if_not(Pred pred) : pred_(pred) {}
> bool operator()(X&&x) const { return !pred_(std::forward<X>(x)); }
> Pred pred_;
> };
>
>
First and foremost this is something different - 'find' no longer does the
work, no longer presents a new interface, one is reusing the old (pre
c++11) find with a helper wrapper
To be perfect analogy there must be some std::find that takes some if_not
type argument, which actually DOES NOT negate, just selects the overload
and find itself does the negation.
Second all wrappers add some penalty either compile type or runtime or both
Third well, one must invent this if_not type (which might or might not be
easy), where otherwise the compiler will generate a tag and the developer
will focus only on the implementation of the function itself
Again, I agree many, many cases are most correctly covered by different
types - days, hours, PercentEncodedBuffer, JpegData, Filename vs Filepath,
etc ect.
But there are many case where types become a cruft.
Basically in all cases where *in the implementation* the types are
interchangeable and assignable to one another.
In a impl. width and height are the same type, cross assignable - a height
is not different from a width. Nothing prevents height to be the width.
>
>> And yea, it should be possible to decltype(if:) and auto ifn = if_not:;
>> *Ideally* a func pointer should be the same as the signature - (*)(width:
>> int) - but initially we could let it be (*)(decltype(width:), int)
>>
>> Labels are always on global scope - if the name exists it is reused, if
>> not it not, it is declared.
>> Namespaces make no sense for labels.
>> They are never <included> from somewhere, and there is no collision or
>> ambiguity in them - size: can label size in geometry functions, physics,
>> clothing, housing, pizza. A label name is its semantics.
>> That is one of the reasons they *should* be handled by the compiler and
>> be transparent to the user, a no-brainer.
>>
>> *Sidenote* on the declaration site the syntax can be case label: in
>> order to feel we are introducing something -
>> a new entity (an argument of type label) AND well, it is correct - we
>> introduce a new case of using the same arguments!
>>
>> InputIt find( InputIt first, InputIt last, case if: UnaryPredicate p );
>>
>> But the : instead of comma should say.
>>
>> Also allowed should be only the least amount of case labels, need to
>> disambiguate - this will prevent syntax maniacs to label every argument!
>> In other words fill_n will NOT be allowed to be rewritten in terms of
>> case labels!
>>
>>
>>
>>> Now sure, when you declare the function, you have to include a bit of
>>> cruft. But quite frankly, tagged parameters of this sort should not be so
>>> common that such cruft appears frequently in code. This is mainly for
>>> one-off cases like top-left vs. bottom-left rectangle coordinates. For
>>> something like angles, you genuinely want to wrap the number in a real type
>>> (since it involves units).
>>>
>>> C++20 gets us close enough that we really don't need specialized syntax.
>>>
>>
>> It will still be a workaround and no new user will dare to try it. We
>> still have to teach it as a "convention", a trick.
>>
>> --
>> 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-proposal...@isocpp.org <javascript:>.
>> To post to this group, send email to std-pr...@isocpp.org <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/ded3cb0a-0128-4d79-b367-3dee64c6e015%40isocpp.org
>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/ded3cb0a-0128-4d79-b367-3dee64c6e015%40isocpp.org?utm_medium=email&utm_source=footer>
>> .
>>
>
--
You received this message because you are subscribed to the Google Groups "ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/484c6371-a2c5-4d57-b6d1-9af71d8f35c4%40isocpp.org.
------=_Part_118712_1847815727.1531228318990
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Tuesday, July 10, 2018 at 2:56:56 PM UTC+3, Ric=
hard Hodges wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;marg=
in-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"=
ltr"><br><br><div class=3D"gmail_quote"><div dir=3D"ltr">On Tue, 10 Jul 201=
8 at 10:18, <<a onmousedown=3D"this.href=3D'javascript:';return =
true;" onclick=3D"this.href=3D'javascript:';return true;" href=3D"j=
avascript:" target=3D"_blank" rel=3D"nofollow" gdf-obfuscated-mailto=3D"ilW=
N0eISBgAJ">mihailn...@gmail.com</a>> wrote:<br></div><blockquote class=
=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padd=
ing-left:1ex"><div dir=3D"ltr"><br><br>On Tuesday, July 10, 2018 at 12:52:4=
6 AM UTC+3, Nicol Bolas wrote:<blockquote class=3D"gmail_quote" style=3D"ma=
rgin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div =
dir=3D"ltr">On Monday, July 9, 2018 at 6:00:59 AM UTC-4, <a>mihailn...@gmai=
l.com</a> 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"><d=
iv><span style=3D"text-align:left;color:rgb(34,34,34);text-transform:none;t=
ext-indent:0px;letter-spacing:normal;font-size:13px;font-style:normal;font-=
variant:normal;font-weight:400;text-decoration:none;word-spacing:0px;displa=
y:inline!important;white-space:normal;float:none;background-color:transpare=
nt"><font face=3D"arial,sans-serif">Basically we can have beautiful and tea=
chable interfaces and the tag stays as implementation detail.</font></span>=
</div></div></blockquote><div><br></div><div>But it's <i>not</i> an &qu=
ot;implementation detail".</div><div><br></div><div>Can I pass `func` =
to a `std::function<void(int)>`? I rather suspect not. Indeed, overlo=
ading aside, what would `&func` return? It would have to be a `void(*)(=
tag_type<"width">, int)`, right? So it's hardly an impl=
ementation detail; it changes the signature of the function.</div><div><br>=
</div><div>This kind of design reminds me of the Coroutines TS: it start wi=
th a syntax and preferred behavior, then does whatever it takes to make tha=
t syntax have the preferred behavior. Comparatively, the Core Corotines pro=
posal is about providing mechanisms which can be used to implement the pref=
erred behavior.</div><div><br></div><div>What I mean is this: your proposal=
is really three related mechanisms. The first is a way to convert an ident=
ifier into a type. The second is a way to pass this identifier/type as a fu=
nction parameter so that it doesn't look like a function parameter at a=
ll. And the third is a way to declare a function that receives this identif=
ier/type as a function parameter, but not using regular function parameter =
syntax.</div><div><br></div><div>I would much rather see this broken down i=
nto individual mechanisms. For example, why does it <i>need</i> to be an id=
entifier? If the calling code were:</div></div></blockquote><div><br></div>=
<div>Once we break things down, we are back at were we started.<br></div><d=
iv>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin:0;margin-l=
eft:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><di=
v><br></div><div><div style=3D"background-color:rgb(250,250,250);border-col=
or:rgb(187,187,187);border-style:solid;border-width:1px"><code><div><span s=
tyle=3D"color:#000">func</span><span style=3D"color:#660">(</span><span sty=
le=3D"color:#080">"width"</span><span style=3D"color:#660">,</spa=
n><span style=3D"color:#000"> width</span><span style=3D"color:#660">);</sp=
an></div></code></div><br></div><div></div><div>Would that be so awful? Is =
the specialized syntax absolutely <i>necessary</i>? Because if we don't=
need that, then we can get that "right now" with C++20's abi=
lity to have strings as type parameters:</div><div><br></div><div><div styl=
e=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);border=
-style:solid;border-width:1px"><code><div><span style=3D"color:#000">func</=
span><span style=3D"color:#660">(</span><span style=3D"color:#080">"wi=
dth"</span><span style=3D"color:#000">tag</span><span style=3D"color:#=
660">,</span><span style=3D"color:#000"> width</span><span style=3D"color:#=
660">);</span></div></code></div></div><div><br></div><div>Where `tag` is a=
UDL which converts the given string into a `func_tag` type.</div><div><br>=
</div></div></blockquote><div><br></div><div>BTW, I am no longer sure we ne=
ed strings</div><div><br></div><div><font face=3D"courier new,monospace">cl=
ass width_tag {};</font></div><div><font face=3D"courier new,monospace"><br=
></font></div><div>should be enough. Strings will be quite heavy, error pro=
ne ("widht") and we don't really need to parse these in compi=
le time, not to motion any raw tag will be invisible to the tools, and we w=
ant tools to know about the function as much as possible</div><div>Also, do=
n't forget templated labels! std::any, std::variant both use them!</div=
><div><br></div><div>But no matter the syntax, it should be first class cit=
izen (syntax highlight, auto-completion, improved error report etc ) and mu=
st feel natural:</div><div><br></div><div><font face=3D"courier new,monospa=
ce">std::find(begin, end, if: []{ /*...*/ });</font></div><div><font face=
=3D"courier new,monospace">std::find(begin, end, if_not: []{ /*...*/ });</f=
ont></div></div></blockquote><blockquote class=3D"gmail_quote" style=3D"mar=
gin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr=
"><div><br>@Thiago Notice, we can control 'find' using SFINAE and w=
hat not. Naming things is fine with people (and front-end code) but it is a=
combo breaker for generic code</div><div>This approach tries to have it bo=
th ways=C2=A0</div><div><br></div><div>@Richard Notice here will also be pl=
ain wrong to have special wrapper types just to express intend</div><div><b=
r></div></div></blockquote><div><br></div><div><div style=3D"background-col=
or:rgb(255,255,255)">Why would this be wrong?</div><div style=3D"background=
-color:rgb(255,255,255)"><br></div><div style=3D"background-color:rgb(255,2=
55,255)"><font face=3D"monospace, monospace">auto condition =3D [](auto&=
;&x) { /* ... */ };</font></div><div style=3D"background-color:rgb(255,=
255,255)"><font face=3D"monospace, monospace">std::find(first, last, if_not=
(condition));</font></div><div style=3D"background-color:rgb(255,255,255)">=
<font style=3D"background-color: transparent;"></font><br></div></div></div=
></div></blockquote><blockquote class=3D"gmail_quote" style=3D"margin: 0;ma=
rgin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=
=3D"ltr"><div class=3D"gmail_quote"><div><div style=3D"background-color:rgb=
(255,255,255)"></div><div style=3D"background-color:rgb(255,255,255)">where=
if_not is defined as:</div><div style=3D"background-color:rgb(255,255,255)=
"><br></div><div style=3D"background-color:rgb(255,255,255)"><font face=3D"=
monospace, monospace">template<class Pred></font></div><div style=3D"=
background-color:rgb(255,255,255)"><font face=3D"monospace, monospace">stru=
ct if_not {</font></div><div style=3D"background-color:rgb(255,255,255)"><f=
ont face=3D"monospace, monospace">=C2=A0 if_not(Pred pred) : pred_(pred) {}=
</font></div><div style=3D"background-color:rgb(255,255,255)"><font face=3D=
"monospace, monospace">=C2=A0 bool operator()(X&&x) const { return =
!pred_(std::forward<X>(x)); }</font></div><div style=3D"background-co=
lor:rgb(255,255,255)"><font face=3D"monospace, monospace">=C2=A0 Pred pred_=
;</font></div><div style=3D"background-color:rgb(255,255,255)"><font face=
=3D"monospace, monospace">};</font></div><div>=C2=A0<br></div></div></div><=
/div></blockquote><div><br></div><div><div style=3D"background-color: trans=
parent; border-bottom-color: rgb(34, 34, 34); border-bottom-style: none; bo=
rder-bottom-width: 0px; border-image-outset: 0; border-image-repeat: stretc=
h; border-image-slice: 100%; border-image-source: none; border-image-width:=
1; border-left-color: rgb(34, 34, 34); border-left-style: none; border-lef=
t-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-st=
yle: 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-sp=
acing: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; mar=
gin-top: 0px; orphans: 2; padding-bottom: 0px; padding-left: 0px; padding-r=
ight: 0px; padding-top: 0px; text-align: left; text-decoration: none; text-=
indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; white-sp=
ace: normal; word-spacing: 0px;"><br style=3D"background-attachment: scroll=
; background-clip: border-box; background-color: transparent; background-im=
age: none; background-origin: padding-box; background-position-x: 0%; backg=
round-position-y: 0%; background-repeat: repeat; background-size: auto; 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; heigh=
t: auto; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-to=
p: 0px; min-width: 0px; overflow: visible; overflow-x: visible; overflow-y:=
visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; paddi=
ng-top: 0px;"></div><div style=3D"background-color: transparent; border-bot=
tom-color: rgb(34, 34, 34); border-bottom-style: none; border-bottom-width:=
0px; border-image-outset: 0; border-image-repeat: stretch; border-image-sl=
ice: 100%; border-image-source: none; border-image-width: 1; border-left-co=
lor: rgb(34, 34, 34); border-left-style: none; border-left-width: 0px; bord=
er-right-color: rgb(34, 34, 34); border-right-style: none; border-right-wid=
th: 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&qu=
ot;,&quot;Helvetica&quot;,sans-serif; font-size: 13px; font-style: =
normal; font-variant: normal; font-weight: 400; letter-spacing: normal; mar=
gin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; orph=
ans: 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;">First and foremost this is something different - 'find&#=
39; no longer does the work, no longer presents a new interface, one is reu=
sing the old (pre c++11) find with a helper wrapper=C2=A0</div><div style=
=3D"background-color: transparent; border-bottom-color: rgb(34, 34, 34); bo=
rder-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, 34); border-l=
eft-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&qu=
ot;,sans-serif; 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; p=
adding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; t=
ext-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-=
stroke-width: 0px; white-space: normal; word-spacing: 0px;"><br style=3D"ba=
ckground-attachment: scroll; background-clip: border-box; background-color:=
transparent; background-image: none; background-origin: padding-box; backg=
round-position-x: 0%; background-position-y: 0%; background-repeat: repeat;=
background-size: auto; 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; color: rgb(34, 34, 34); f=
ont-family: &quot;Arial&quot;,&quot;Helvetica&quot;,sans-se=
rif; font-size: 13px; height: auto; margin-bottom: 0px; margin-left: 0px; m=
argin-right: 0px; margin-top: 0px; min-width: 0px; overflow: visible; overf=
low-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px=
; padding-right: 0px; padding-top: 0px;"></div><div style=3D"background-col=
or: transparent; border-bottom-color: rgb(34, 34, 34); border-bottom-style:=
none; border-bottom-width: 0px; border-image-outset: 0; border-image-repea=
t: stretch; border-image-slice: 100%; border-image-source: none; border-ima=
ge-width: 1; border-left-color: rgb(34, 34, 34); border-left-style: none; b=
order-left-width: 0px; border-right-color: rgb(34, 34, 34); border-right-st=
yle: none; border-right-width: 0px; border-top-color: rgb(34, 34, 34); bord=
er-top-style: none; border-top-width: 0px; color: rgb(34, 34, 34); font-fam=
ily: &quot;Arial&quot;,&quot;Helvetica&quot;,sans-serif; fo=
nt-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-decoration: no=
ne; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px;=
white-space: normal; word-spacing: 0px;">To be perfect analogy there must =
be some std::find that takes some if_not type argument, which actually DOES=
NOT negate, just selects the overload and find itself does the negation.</=
div><div style=3D"background-color: transparent; border-bottom-color: rgb(3=
4, 34, 34); border-bottom-style: none; border-bottom-width: 0px; border-ima=
ge-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; borde=
r-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;He=
lvetica&quot;,sans-serif; font-size: 13px; font-style: normal; font-var=
iant: 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-decoration: none; text-indent: 0px; text-transform: none;=
-webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"><=
br style=3D"background-attachment: scroll; background-clip: border-box; bac=
kground-color: transparent; background-image: none; background-origin: padd=
ing-box; background-position-x: 0%; background-position-y: 0%; background-r=
epeat: repeat; background-size: auto; 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; height: auto; margin-bottom: 0px; margi=
n-left: 0px; margin-right: 0px; margin-top: 0px; min-width: 0px; overflow: =
visible; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; pad=
ding-left: 0px; padding-right: 0px; padding-top: 0px;"></div><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; bord=
er-image-repeat: stretch; border-image-slice: 100%; border-image-source: no=
ne; 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); b=
order-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; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px;=
margin-right: 0px; margin-top: 0px; orphans: 2; padding-bottom: 0px; paddi=
ng-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; text-=
decoration: none; text-indent: 0px; text-transform: none; -webkit-text-stro=
ke-width: 0px; white-space: normal; word-spacing: 0px;">Second all wrappers=
add some penalty either compile type or runtime or both</div><div style=3D=
"background-color: transparent; border-bottom-color: rgb(34, 34, 34); borde=
r-bottom-style: none; border-bottom-width: 0px; border-image-outset: 0; bor=
der-image-repeat: stretch; border-image-slice: 100%; border-image-source: n=
one; 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: normal; font-variant: normal; fon=
t-weight: 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px=
; margin-right: 0px; margin-top: 0px; orphans: 2; padding-bottom: 0px; padd=
ing-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; text=
-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-str=
oke-width: 0px; white-space: normal; word-spacing: 0px;"><br style=3D"backg=
round-attachment: scroll; background-clip: border-box; background-color: tr=
ansparent; background-image: none; background-origin: padding-box; backgrou=
nd-position-x: 0%; background-position-y: 0%; background-repeat: repeat; ba=
ckground-size: auto; border-bottom-color: rgb(34, 34, 34); border-bottom-st=
yle: none; border-bottom-width: 0px; border-image-outset: 0; border-image-r=
epeat: stretch; border-image-slice: 100%; border-image-source: none; border=
-image-width: 1; border-left-color: rgb(34, 34, 34); border-left-style: non=
e; border-left-width: 0px; border-right-color: rgb(34, 34, 34); border-righ=
t-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; marg=
in-right: 0px; margin-top: 0px; min-width: 0px; overflow: visible; overflow=
-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; p=
adding-right: 0px; padding-top: 0px;"></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;">Third well, one must invent this if_=
not type (which might or might not be easy), where otherwise the compiler w=
ill generate a tag and the developer will focus only on the implementation =
of the function itself</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;">Again, I agree many, many cases are most correctly covered by differen=
t types - days, hours, PercentEncodedBuffer, JpegData, Filename vs Filepath=
, etc ect.=C2=A0</div><div style=3D"background-color: transparent; border-b=
ottom-color: rgb(34, 34, 34); border-bottom-style: none; border-bottom-widt=
h: 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; bo=
rder-right-color: rgb(34, 34, 34); border-right-style: none; border-right-w=
idth: 0px; border-top-color: rgb(34, 34, 34); border-top-style: none; borde=
r-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: 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;">But there are many case where types become a cruft.=C2=A0<=
/div><div style=3D"background-color: transparent; border-bottom-color: rgb(=
34, 34, 34); border-bottom-style: none; border-bottom-width: 0px; border-im=
age-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; bord=
er-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;H=
elvetica&quot;,sans-serif; font-size: 13px; font-style: normal; font-va=
riant: 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-decoration: none; text-indent: 0px; text-transform: none=
; -webkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">=
<br style=3D"background-attachment: scroll; background-clip: border-box; ba=
ckground-color: transparent; background-image: none; background-origin: pad=
ding-box; background-position-x: 0%; background-position-y: 0%; background-=
repeat: repeat; background-size: auto; 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; height: auto; margin-bottom: 0px; marg=
in-left: 0px; margin-right: 0px; margin-top: 0px; min-width: 0px; overflow:=
visible; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; pa=
dding-left: 0px; padding-right: 0px; padding-top: 0px;"></div><div style=3D=
"background-color: transparent; border-bottom-color: rgb(34, 34, 34); borde=
r-bottom-style: none; border-bottom-width: 0px; border-image-outset: 0; bor=
der-image-repeat: stretch; border-image-slice: 100%; border-image-source: n=
one; 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: normal; font-variant: normal; fon=
t-weight: 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px=
; margin-right: 0px; margin-top: 0px; orphans: 2; padding-bottom: 0px; padd=
ing-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; text=
-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-str=
oke-width: 0px; white-space: normal; word-spacing: 0px;">Basically in all c=
ases where <i style=3D"background-attachment: scroll; background-clip: bord=
er-box; background-color: transparent; background-image: none; background-o=
rigin: padding-box; background-position-x: 0%; background-position-y: 0%; b=
ackground-repeat: repeat; background-size: auto; border-bottom-color: rgb(3=
4, 34, 34); border-bottom-style: none; border-bottom-width: 0px; border-ima=
ge-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; borde=
r-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;He=
lvetica&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; overflow-x: visible; overflow-y: visible; padding-botto=
m: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">in the im=
plementation</i> the types are interchangeable and assignable to one anothe=
r.<br style=3D"background-attachment: scroll; background-clip: border-box; =
background-color: transparent; background-image: none; background-origin: p=
adding-box; background-position-x: 0%; background-position-y: 0%; backgroun=
d-repeat: repeat; background-size: auto; border-bottom-color: rgb(34, 34, 3=
4); border-bottom-style: none; border-bottom-width: 0px; border-image-outse=
t: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-=
source: none; border-image-width: 1; border-left-color: rgb(34, 34, 34); bo=
rder-left-style: none; border-left-width: 0px; border-right-color: rgb(34, =
34, 34); border-right-style: none; border-right-width: 0px; border-top-colo=
r: rgb(34, 34, 34); border-top-style: none; border-top-width: 0px; color: r=
gb(34, 34, 34); font-family: &quot;Arial&quot;,&quot;Helvetica&=
amp;quot;,sans-serif; font-size: 13px; height: auto; margin-bottom: 0px; ma=
rgin-left: 0px; margin-right: 0px; margin-top: 0px; min-width: 0px; overflo=
w: visible; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; =
padding-left: 0px; padding-right: 0px; padding-top: 0px;"></div><div style=
=3D"background-color: transparent; border-bottom-color: rgb(34, 34, 34); bo=
rder-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, 34); border-l=
eft-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&qu=
ot;,sans-serif; 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; p=
adding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; t=
ext-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-=
stroke-width: 0px; white-space: normal; word-spacing: 0px;">In a impl. widt=
h and height are the same type, cross assignable - a height is not differen=
t from a width. Nothing prevents height to be the width.<br style=3D"backgr=
ound-attachment: scroll; background-clip: border-box; background-color: tra=
nsparent; background-image: none; background-origin: padding-box; backgroun=
d-position-x: 0%; background-position-y: 0%; background-repeat: repeat; bac=
kground-size: auto; 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; height: auto; margin-bottom: 0px; margin-left: 0px; margi=
n-right: 0px; margin-top: 0px; min-width: 0px; overflow: visible; overflow-=
x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; pa=
dding-right: 0px; padding-top: 0px;"></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>=C2=A0</div><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 class=3D"gmail_quote"><div><=
div></div></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8e=
x;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div></div>=
<div><br>And yea, it should be possible to <font face=3D"courier new,monosp=
ace">decltype(if:)</font> and<font face=3D"courier new,monospace"> auto ifn=
=3D if_not:;</font></div><div><font face=3D"arial,sans-serif"><i>Ideally</=
i> a func pointer should be the same as the signature - <font face=3D"couri=
er new,monospace" style=3D"border-bottom-color:rgb(34,34,34);border-bottom-=
style:none;border-bottom-width:0px;border-left-color:rgb(34,34,34);border-l=
eft-style: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);bo=
rder-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">(*)(width: int)</font></font><font face=3D"aria=
l,sans-serif"><font style=3D"border-bottom-color:rgb(34,34,34);border-botto=
m-style:none;border-bottom-width:0px;border-left-color:rgb(34,34,34);border=
-left-style:none;border-left-width:0px;border-right-color:rgb(34,34,34);bor=
der-right-style:none;border-right-width:0px;border-top-color:rgb(34,34,34);=
border-top-style:none;border-top-width:0px;margin-bottom:0px;margin-left:0p=
x;margin-right:0px;margin-top:0px;padding-bottom:0px;padding-left:0px;paddi=
ng-right:0px;padding-top:0px"> - </font>but initially we could let it be </=
font><font face=3D"courier new,monospace">(*)(decltype(<span style=3D"displ=
ay:inline!important;float:none;background-color:transparent;color:rgb(34,34=
,34);font-family:courier new,monospace;font-size:13px;font-style:normal;fon=
t-variant:normal;font-weight:400;letter-spacing:normal;text-align:left;text=
-decoration:none;text-indent:0px;text-transform:none;white-space:normal;wor=
d-spacing:0px">width</span>:), int)</font></div><div><br></div><div><font f=
ace=3D"arial,sans-serif">Labels are always on global scope - if the name ex=
ists it is reused, if not it not, it is declared.=C2=A0</font></div><div><f=
ont face=3D"arial,sans-serif">Namespaces make no sense for labels.=C2=A0</f=
ont></div><div><font face=3D"arial,sans-serif">They are never <included&=
gt; from somewhere, and there is no collision or ambiguity in them - </font=
><font face=3D"courier new,monospace">size: </font><font face=3D"arial,sans=
-serif">can label size in geometry functions, physics, clothing, housing, p=
izza. </font><font face=3D"arial,sans-serif">A label name is its semantics.=
=C2=A0</font></div><div><font face=3D"arial,sans-serif">That is one of the =
reasons they <i>should</i> be handled by the compiler and be transparent to=
the user, a no-brainer.=C2=A0</font></div><div><font face=3D"courier new,m=
onospace"><b></b><i></i><u></u><sub></sub><sup></sup><strike></strike><font=
face=3D"arial,sans-serif"></font><font face=3D"arial,sans-serif"></font><b=
r></font></div><div><b>Sidenote</b> on the declaration site the syntax can =
be<font face=3D"courier new,monospace"> case label:</font> in order to feel=
we are introducing something - <br>a new entity (an argument of type label=
) AND well, it is correct - we introduce a new case of using the same argum=
ents!</div><div><font face=3D"courier new,monospace"></font><br></div><div>=
<font face=3D"courier new,monospace">InputIt find( InputIt first, InputIt l=
ast, case if: UnaryPredicate p );</font></div><div><font face=3D"courier ne=
w,monospace"><br></font></div><div>But the <font face=3D"courier new,monosp=
ace">:</font> instead of comma should say.=C2=A0</div><div><br>Also allowed=
should be only the least amount of case labels, need to disambiguate - thi=
s will prevent syntax maniacs to label every argument!</div><div>In other w=
ords <font face=3D"courier new,monospace">fill_n </font>will NOT be allowed=
to be rewritten in terms of case labels!<br></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></di=
v><div>Now sure, when you declare the function, you have to include a bit o=
f cruft. But quite frankly, tagged parameters of this sort should not be so=
common that such cruft appears frequently in code. This is mainly for one-=
off cases like top-left vs. bottom-left rectangle coordinates. For somethin=
g like angles, you genuinely want to wrap the number in a real type (since =
it involves units).</div><div><br></div><div>C++20 gets us close enough tha=
t we really don't need specialized syntax.<br></div></div></blockquote>=
<div><br></div><div>It will still be a workaround and no new user will dare=
to try it. We still have to teach it as a "convention", a trick.=
=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 onmousedown=3D"this.href=3D'javascript:';return true;" o=
nclick=3D"this.href=3D'javascript:';return true;" href=3D"javascrip=
t:" target=3D"_blank" rel=3D"nofollow" gdf-obfuscated-mailto=3D"ilWN0eISBgA=
J">std-proposal...@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a onmousedown=3D"this.href=3D'jav=
ascript:';return true;" onclick=3D"this.href=3D'javascript:';re=
turn true;" href=3D"javascript:" target=3D"_blank" rel=3D"nofollow" gdf-obf=
uscated-mailto=3D"ilWN0eISBgAJ">std-pr...@isocpp.org</a>.<br>
To view this discussion on the web visit <a onmousedown=3D"this.href=3D'=
;https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/ded3cb0a-0128=
-4d79-b367-3dee64c6e015%40isocpp.org?utm_medium\x3demail\x26utm_source\x3df=
ooter';return true;" onclick=3D"this.href=3D'https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/ded3cb0a-0128-4d79-b367-3dee64c6e015=
%40isocpp.org?utm_medium\x3demail\x26utm_source\x3dfooter';return true;=
" href=3D"https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/ded3=
cb0a-0128-4d79-b367-3dee64c6e015%40isocpp.org?utm_medium=3Demail&utm_so=
urce=3Dfooter" target=3D"_blank" rel=3D"nofollow">https://groups.google.com=
/a/<wbr>isocpp.org/d/msgid/std-<wbr>proposals/ded3cb0a-0128-4d79-<wbr>b367-=
3dee64c6e015%40isocpp.org</a><wbr>.<br>
</blockquote></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/484c6371-a2c5-4d57-b6d1-9af71d8f35c4%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/484c6371-a2c5-4d57-b6d1-9af71d8f35c4=
%40isocpp.org</a>.<br />
------=_Part_118712_1847815727.1531228318990--
------=_Part_118711_1908680244.1531228318989--
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Tue, 10 Jul 2018 06:54:23 -0700 (PDT)
Raw View
------=_Part_15127_1481285748.1531230863677
Content-Type: multipart/alternative;
boundary="----=_Part_15128_92389466.1531230863677"
------=_Part_15128_92389466.1531230863677
Content-Type: text/plain; charset="UTF-8"
On Tuesday, July 10, 2018 at 5:18:22 AM UTC-4, mihailn...@gmail.com wrote:
>
>
>
> On Tuesday, July 10, 2018 at 12:52:46 AM UTC+3, Nicol Bolas wrote:
>>
>> On Monday, July 9, 2018 at 6:00:59 AM UTC-4, mihailn...@gmail.com wrote:
>>>
>>> Basically we can have beautiful and teachable interfaces and the tag
>>> stays as implementation detail.
>>>
>>
>> But it's *not* an "implementation detail".
>>
>> Can I pass `func` to a `std::function<void(int)>`? I rather suspect not.
>> Indeed, overloading aside, what would `&func` return? It would have to be a
>> `void(*)(tag_type<"width">, int)`, right? So it's hardly an implementation
>> detail; it changes the signature of the function.
>>
>> This kind of design reminds me of the Coroutines TS: it start with a
>> syntax and preferred behavior, then does whatever it takes to make that
>> syntax have the preferred behavior. Comparatively, the Core Corotines
>> proposal is about providing mechanisms which can be used to implement the
>> preferred behavior.
>>
>> What I mean is this: your proposal is really three related mechanisms.
>> The first is a way to convert an identifier into a type. The second is a
>> way to pass this identifier/type as a function parameter so that it doesn't
>> look like a function parameter at all. And the third is a way to declare a
>> function that receives this identifier/type as a function parameter, but
>> not using regular function parameter syntax.
>>
>> I would much rather see this broken down into individual mechanisms. For
>> example, why does it *need* to be an identifier? If the calling code
>> were:
>>
>
> Once we break things down, we are back at were we started.
>
Which is the point: if you properly break down a feature, and it turns out
that it doesn't buy you much at all... then why do you need it? I have a
strong dislike for bulldozer language design, where you have a way you want
people's code to look, and you run a bulldozer through anything that gets
in the way. Sometimes, it is necessary and it does produce elegant code.
But it also creates inflexible code, creating lots of one-off syntax that
can only ever be used for one thing.
I prefer mechanisms to policies. Let's give users to tools to create the
policies they want.
func("width", width);
>>
>> Would that be so awful? Is the specialized syntax absolutely *necessary*?
>> Because if we don't need that, then we can get that "right now" with
>> C++20's ability to have strings as type parameters:
>>
>> func("width"tag, width);
>>
>> Where `tag` is a UDL which converts the given string into a `func_tag`
>> type.
>>
>>
> BTW, I am no longer sure we need strings
>
> class width_tag {};
>
> should be enough.
>
That opens up a can of worms. What namespace is that in (and FYI: the
global namespace is the *wrong answer*)? Can you `export` it into a module?
Does it get `import`ed it? What happens if there's already a type of that
name declared in that namespace elsewhere?
If it's a standard library template that gets instantiated, then all of
those questions go away.
Strings will be quite heavy, error prone ("widht") and we don't really need
> to parse these in compile time, not to motion any raw tag will be invisible
> to the tools, and we want tools to know about the function as much as
> possible
>
It will be as invisible to tools as the tools want them to be. That's the
point of putting things in the standard library; they become *standard*.
Also, don't forget templated labels! std::any, std::variant both use them!
>
> But no matter the syntax, it should be first class citizen (syntax
> highlight, auto-completion, improved error report etc ) and must feel
> natural:
>
> std::find(begin, end, if: []{ /*...*/ });
> std::find(begin, end, if_not: []{ /*...*/ });
>
.... No. Really, no. There's no reason why we shouldn't have that for
something that could easily be part of the function's *name*. Or better
yet, simply negating the condition.
What generic code needs to do this? The difference between `find_if` and
`find_if_not` is literally just a negation on the return value of the
functor. With C++11 lambdas, there's no excuse for you not doing that
negation yourself.
> Also allowed should be only the least amount of case labels, need to
> disambiguate - this will prevent syntax maniacs to label every argument!
>
In other words fill_n will NOT be allowed to be rewritten in terms of case
> labels!
>
.... how are you going to *stop* someone from doing that? I mean, it's not
like they can redeclare other people's functions with these; they'd have to
be writing their own `fill_n`. And we're not going to rewrite the standard
library algorithms for a *third time* just for this nonsense.
So if someone's writing their own fill_n, how are you going to stop them
from just calling it `fill` and using a label?
>
>
>
>> Now sure, when you declare the function, you have to include a bit of
>> cruft. But quite frankly, tagged parameters of this sort should not be so
>> common that such cruft appears frequently in code. This is mainly for
>> one-off cases like top-left vs. bottom-left rectangle coordinates. For
>> something like angles, you genuinely want to wrap the number in a real type
>> (since it involves units).
>>
>> C++20 gets us close enough that we really don't need specialized syntax.
>>
>
> It will still be a workaround and no new user will dare to try it. We
> still have to teach it as a "convention", a trick.
>
But it *is* a trick, even with your syntax. With your way, you have to
teach them that you can create parameters and arguments that don't look
like parameters and arguments. Consistency is important, and new users will
be a bit perplexed that `i, width: i` is somehow three parameters despite
the lack of a comma.
New users would learn it as convention, as style, not as "colon-identifers
become parameters". That's a detail they will not absorb. Which means
they're going to be really confused when they see `auto val = width:;`.
They won't have any idea what to make of that, and how can you blame them.
Just look at the inconsistency in the function declaration compared to its
actual type. `void func(width: int i)` has no comma to separate the two
parameters. `void(decltype(width:), int i)` does have a comma.
Regularity is one of the most important things that make a language
teachable. Clever syntax allows new users to pick something up quickly. But
the thing that makes it easiest for them to matriculate from new user to
skilled user is *regularity*. A regular language is one where you never
have to lie to them when they're new users. Where, when they learn a thing,
they learn it correctly and entirely, even as a new user. And that's what
you're doing here when your colon identifiers don't have commas between
them and the next parameter.
Now if your syntax were `func(:width:, i)`, that would at least be
consistent with other arguments. I know that a goal of your syntax is to
make them not appear to be parameters, but that's a bad goal. If something
is a parameter, it should look like any other parameter.
Overall, my point is this: the need for this feature is not great enough
for it to take up special syntax and have special meaning. I recognize that
it is useful, but it is not sufficiently broadly useful for it to absorb
syntax. Especially with such inconsistent syntax.
--
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/9452dafe-1007-4486-bfff-804f7c00b54c%40isocpp.org.
------=_Part_15128_92389466.1531230863677
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Tuesday, July 10, 2018 at 5:18:22 AM UTC-4, mih=
ailn...@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 d=
ir=3D"ltr"><br><br>On Tuesday, July 10, 2018 at 12:52:46 AM UTC+3, Nicol Bo=
las 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">On Monda=
y, July 9, 2018 at 6:00:59 AM UTC-4, <a>mihailn...@gmail.com</a> wrote:<blo=
ckquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-le=
ft:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div><span style=3D"te=
xt-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0px;lette=
r-spacing:normal;font-size:13px;font-style:normal;font-variant:normal;font-=
weight:400;text-decoration:none;word-spacing:0px;display:inline!important;w=
hite-space:normal;float:none;background-color:transparent"><font face=3D"ar=
ial,sans-serif">Basically we can have beautiful and teachable interfaces an=
d the tag stays as implementation detail.</font></span></div></div></blockq=
uote><div><br></div><div>But it's <i>not</i> an "implementation de=
tail".</div><div><br></div><div>Can I pass `func` to a `std::function&=
lt;void(int)>`? I rather suspect not. Indeed, overloading aside, what wo=
uld `&func` return? It would have to be a `void(*)(tag_type<"wi=
dth">, int)`, right? So it's hardly an implementation detail; i=
t changes the signature of the function.</div><div><br></div><div>This kind=
of design reminds me of the Coroutines TS: it start with a syntax and pref=
erred behavior, then does whatever it takes to make that syntax have the pr=
eferred behavior. Comparatively, the Core Corotines proposal is about provi=
ding mechanisms which can be used to implement the preferred behavior.</div=
><div><br></div><div>What I mean is this: your proposal is really three rel=
ated mechanisms. The first is a way to convert an identifier into a type. T=
he second is a way to pass this identifier/type as a function parameter so =
that it doesn't look like a function parameter at all. And the third is=
a way to declare a function that receives this identifier/type as a functi=
on parameter, but not using regular function parameter syntax.</div><div><b=
r></div><div>I would much rather see this broken down into individual mecha=
nisms. For example, why does it <i>need</i> to be an identifier? If the cal=
ling code were:</div></div></blockquote><div><br></div><div>Once we break t=
hings down, we are back at were we started.<br></div></div></blockquote><di=
v><br></div><div>Which is the point: if you properly break down a feature, =
and it turns out that it doesn't buy you much at all... then why do you=
need it? I have a strong dislike for bulldozer language design, where you =
have a way you want people's code to look, and you run a bulldozer thro=
ugh anything that gets in the way. Sometimes, it is necessary and it does p=
roduce elegant code. But it also creates inflexible code, creating lots of =
one-off syntax that can only ever be used for one thing.<br></div><div><br>=
</div><div>I prefer mechanisms to policies. Let's give users to tools t=
o create the policies they want.<br></div><div><br></div><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></div><div></div><blockqu=
ote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1=
px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div></div><div><div style=
=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-=
style:solid;border-width:1px"><code><div><span style=3D"color:#000">func</s=
pan><span style=3D"color:#660">(</span><span style=3D"color:#080">"wid=
th"</span><span style=3D"color:#660">,</span><span style=3D"color:#000=
"> width</span><span style=3D"color:#660">);</span></div></code></div><br><=
/div><div></div><div>Would that be so awful? Is the specialized syntax abso=
lutely <i>necessary</i>? Because if we don't need that, then we can get=
that "right now" with C++20's ability to have strings as typ=
e parameters:</div><div><br></div><div><div style=3D"background-color:rgb(2=
50,250,250);border-color:rgb(187,187,187);border-style:solid;border-width:1=
px"><code><div><span style=3D"color:#000">func</span><span style=3D"color:#=
660">(</span><span style=3D"color:#080">"width"</span><span style=
=3D"color:#000">tag</span><span style=3D"color:#660">,</span><span style=3D=
"color:#000"> width</span><span style=3D"color:#660">);</span></div></code>=
</div></div><div><br></div><div>Where `tag` is a UDL which converts the giv=
en string into a `func_tag` type.</div><div><br></div></div></blockquote><d=
iv><br></div><div>BTW, I am no longer sure we need strings</div><div><br></=
div><div><font face=3D"courier new,monospace">class width_tag {};</font></d=
iv><div><font face=3D"courier new,monospace"><br></font></div><div>should b=
e enough.</div></div></blockquote><div><br></div><div>That opens up a can o=
f worms. What namespace is that in (and FYI: the global namespace is the <i=
>wrong answer</i>)? Can you `export` it into a module? Does it get `import`=
ed it? What happens if there's already a type of that name declared in =
that namespace elsewhere?<br></div><div><br></div><div>If it's a standa=
rd library template that gets instantiated, then all of those questions go =
away.<br></div><div><br></div><blockquote class=3D"gmail_quote" style=3D"ma=
rgin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">=
<div dir=3D"ltr"><div>Strings will be quite heavy, error prone ("widht=
") and we don't really need to parse these in compile time, not to=
motion any raw tag will be invisible to the tools, and we want tools to kn=
ow about the function as much as possible</div></div></blockquote><div><br>=
</div><div>It will be as invisible to tools as the tools want them to be. T=
hat's the point of putting things in the standard library; they become =
<i>standard</i>.<br></div><div><br></div><blockquote class=3D"gmail_quote" =
style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-l=
eft: 1ex;"><div dir=3D"ltr"><div>Also, don't forget templated labels! s=
td::any, std::variant both use them!</div><div><br></div><div>But no matter=
the syntax, it should be first class citizen (syntax highlight, auto-compl=
etion, improved error report etc ) and must feel natural:</div><div><br></d=
iv><div><font face=3D"courier new,monospace">std::find(begin, end, if: []{ =
/*...*/ });</font></div><div><font face=3D"courier new,monospace">std::find=
(begin, end, if_not: []{ /*...*/ });</font></div></div></blockquote><div>=
=C2=A0</div><div>... No. Really, no. There's no reason why we shouldn&#=
39;t have that for something that could easily be part of the function'=
s <i>name</i>. Or better yet, simply negating the condition.</div><div><br>=
</div><div>What generic code needs to do this? The difference between `find=
_if` and `find_if_not` is literally just a negation on the return value of =
the functor. With C++11 lambdas, there's no excuse for you not doing th=
at negation yourself.</div><div>=C2=A0</div><blockquote class=3D"gmail_quot=
e" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;paddin=
g-left: 1ex;"><div dir=3D"ltr"><div>Also allowed should be only the least a=
mount of case labels, need to disambiguate - this will prevent syntax mania=
cs to label every argument! <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>In other words <font face=
=3D"courier new,monospace">fill_n </font>will NOT be allowed to be rewritte=
n in terms of case labels!<br></div></div></blockquote><div><br></div><div>=
.... how are you going to <i>stop</i> someone from doing that? I mean, it=
9;s not like they can redeclare other people's functions with these; th=
ey'd have to be writing their own `fill_n`. And we're not going to =
rewrite the standard library algorithms for a <i>third time</i> just for th=
is nonsense.</div><div><br></div><div>So if someone's writing their own=
fill_n, how are you going to stop them from just calling it `fill` and usi=
ng a label?<br></div><div>=C2=A0</div><blockquote class=3D"gmail_quote" sty=
le=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left=
: 1ex;"><div dir=3D"ltr"><div></div><div><br></div><div>=C2=A0</div><blockq=
uote 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></div><div>Now sure,=
when you declare the function, you have to include a bit of cruft. But qui=
te frankly, tagged parameters of this sort should not be so common that suc=
h cruft appears frequently in code. This is mainly for one-off cases like t=
op-left vs. bottom-left rectangle coordinates. For something like angles, y=
ou genuinely want to wrap the number in a real type (since it involves unit=
s).</div><div><br></div><div>C++20 gets us close enough that we really don&=
#39;t need specialized syntax.<br></div></div></blockquote><div><br></div><=
div>It will still be a workaround and no new user will dare to try it. We s=
till have to teach it as a "convention", a trick.=C2=A0</div></di=
v></blockquote><div><br></div><div>But it <i>is</i> a trick, even with your=
syntax. With your way, you have to teach them that you can create paramete=
rs and arguments that don't look like parameters and arguments. Consist=
ency is important, and new users will be a bit perplexed that `i, width: i`=
is somehow three parameters despite the lack of a comma.</div><div><br></d=
iv><div>New users would learn it as convention, as style, not as "colo=
n-identifers become parameters". That's a detail they will not abs=
orb. Which means they're going to be really confused when they see `aut=
o val =3D width:;`. They won't have any idea what to make of that, and =
how can you blame them.<br></div><div><br></div><div>Just look at the incon=
sistency in the function declaration compared to its actual type. `void fun=
c(width: int i)` has no comma to separate the two parameters. `void(decltyp=
e(width:), int i)` does have a comma.</div><div><br></div><div>Regularity i=
s one of the most important things that make a language teachable. Clever s=
yntax allows new users to pick something up quickly. But the thing that mak=
es it easiest for them to matriculate from new user to skilled user is <i>r=
egularity</i>. A regular language is one where you never have to lie to the=
m when they're new users. Where, when they learn a thing, they learn it=
correctly and entirely, even as a new user. And that's what you're=
doing here when your colon identifiers don't have commas between them =
and the next parameter.<br></div><div><br></div>Now if your syntax were `fu=
nc(:width:, i)`, that would at least be consistent with other arguments. I =
know that a goal of your syntax is to make them not appear to be parameters=
, but that's a bad goal. If something is a parameter, it should look li=
ke any other parameter.<div><br></div><div>Overall, my point is this: the n=
eed for this feature is not great enough for it to take up special syntax a=
nd have special meaning. I recognize that it is useful, but it is not suffi=
ciently broadly useful for it to absorb syntax. Especially with such incons=
istent syntax.<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/9452dafe-1007-4486-bfff-804f7c00b54c%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/9452dafe-1007-4486-bfff-804f7c00b54c=
%40isocpp.org</a>.<br />
------=_Part_15128_92389466.1531230863677--
------=_Part_15127_1481285748.1531230863677--
.
Author: mihailnajdenov@gmail.com
Date: Tue, 10 Jul 2018 08:36:05 -0700 (PDT)
Raw View
------=_Part_78451_896940243.1531236965425
Content-Type: multipart/alternative;
boundary="----=_Part_78452_1211517455.1531236965426"
------=_Part_78452_1211517455.1531236965426
Content-Type: text/plain; charset="UTF-8"
On Tuesday, July 10, 2018 at 4:54:23 PM UTC+3, Nicol Bolas wrote:
>
>
>
> On Tuesday, July 10, 2018 at 5:18:22 AM UTC-4, mihailn...@gmail.com wrote:
>>
>>
>>
>> On Tuesday, July 10, 2018 at 12:52:46 AM UTC+3, Nicol Bolas wrote:
>>>
>>> On Monday, July 9, 2018 at 6:00:59 AM UTC-4, mihailn...@gmail.com wrote:
>>>>
>>>> Basically we can have beautiful and teachable interfaces and the tag
>>>> stays as implementation detail.
>>>>
>>>
>>> But it's *not* an "implementation detail".
>>>
>>> Can I pass `func` to a `std::function<void(int)>`? I rather suspect not.
>>> Indeed, overloading aside, what would `&func` return? It would have to be a
>>> `void(*)(tag_type<"width">, int)`, right? So it's hardly an implementation
>>> detail; it changes the signature of the function.
>>>
>>> This kind of design reminds me of the Coroutines TS: it start with a
>>> syntax and preferred behavior, then does whatever it takes to make that
>>> syntax have the preferred behavior. Comparatively, the Core Corotines
>>> proposal is about providing mechanisms which can be used to implement the
>>> preferred behavior.
>>>
>>> What I mean is this: your proposal is really three related mechanisms.
>>> The first is a way to convert an identifier into a type. The second is a
>>> way to pass this identifier/type as a function parameter so that it doesn't
>>> look like a function parameter at all. And the third is a way to declare a
>>> function that receives this identifier/type as a function parameter, but
>>> not using regular function parameter syntax.
>>>
>>> I would much rather see this broken down into individual mechanisms. For
>>> example, why does it *need* to be an identifier? If the calling code
>>> were:
>>>
>>
>> Once we break things down, we are back at were we started.
>>
>
> Which is the point: if you properly break down a feature, and it turns out
> that it doesn't buy you much at all... then why do you need it? I have a
> strong dislike for bulldozer language design, where you have a way you want
> people's code to look, and you run a bulldozer through anything that gets
> in the way. Sometimes, it is necessary and it does produce elegant code.
> But it also creates inflexible code, creating lots of one-off syntax that
> can only ever be used for one thing.
>
> I prefer mechanisms to policies. Let's give users to tools to create the
> policies they want.
>
> func("width", width);
>>>
>>> Would that be so awful? Is the specialized syntax absolutely *necessary*?
>>> Because if we don't need that, then we can get that "right now" with
>>> C++20's ability to have strings as type parameters:
>>>
>>> func("width"tag, width);
>>>
>>> Where `tag` is a UDL which converts the given string into a `func_tag`
>>> type.
>>>
>>>
>> BTW, I am no longer sure we need strings
>>
>> class width_tag {};
>>
>> should be enough.
>>
>
>
> That opens up a can of worms. What namespace is that in (and FYI: the
> global namespace is the *wrong answer*)? Can you `export` it into a
> module? Does it get `import`ed it? What happens if there's already a type
> of that name declared in that namespace elsewhere?
>
> If it's a standard library template that gets instantiated, then all of
> those questions go away.
>
Sure, it must be investigated I am not focusing on the impl too much right
now.
>
> Strings will be quite heavy, error prone ("widht") and we don't really
>> need to parse these in compile time, not to motion any raw tag will be
>> invisible to the tools, and we want tools to know about the function as
>> much as possible
>>
>
> It will be as invisible to tools as the tools want them to be. That's the
> point of putting things in the standard library; they become *standard*.
>
> Also, don't forget templated labels! std::any, std::variant both use them!
>>
>> But no matter the syntax, it should be first class citizen (syntax
>> highlight, auto-completion, improved error report etc ) and must feel
>> natural:
>>
>> std::find(begin, end, if: []{ /*...*/ });
>> std::find(begin, end, if_not: []{ /*...*/ });
>>
>
> ... No. Really, no. There's no reason why we shouldn't have that for
> something that could easily be part of the function's *name*. Or better
> yet, simply negating the condition.
>
>
> What generic code needs to do this? The difference between `find_if` and
> `find_if_not` is literally just a negation on the return value of the
> functor. With C++11 lambdas, there's no excuse for you not doing that
> negation yourself.
>
It was just an illustration and the point was more find vs find_if, where
it becomes more generic, not find_if vs find_if_not!
>
>> Also allowed should be only the least amount of case labels, need to
>> disambiguate - this will prevent syntax maniacs to label every argument!
>>
> In other words fill_n will NOT be allowed to be rewritten in terms of
>> case labels!
>>
>
> ... how are you going to *stop* someone from doing that? I mean, it's not
> like they can redeclare other people's functions with these; they'd have to
> be writing their own `fill_n`. And we're not going to rewrite the standard
> library algorithms for a *third time* just for this nonsense.
>
> So if someone's writing their own fill_n, how are you going to stop them
> from just calling it `fill` and using a label?
>
I really hope, there is a way. Otherwise they will be abused for horrible
APIs with double mount of arguments, a total mess.
If it is not possible, then it will be better to pretend these are
arguments - with a lot of automatic behavior like the hidden type,
usage-is-declaration and so on
To just label arguments, not to create a new overload, a weak named
arguments must be used that do not introduce arguments, don't change the
signature and are optional.
These are different, a different topic altogether.
>
>
>>
>>
>>
>>> Now sure, when you declare the function, you have to include a bit of
>>> cruft. But quite frankly, tagged parameters of this sort should not be so
>>> common that such cruft appears frequently in code. This is mainly for
>>> one-off cases like top-left vs. bottom-left rectangle coordinates. For
>>> something like angles, you genuinely want to wrap the number in a real type
>>> (since it involves units).
>>>
>>> C++20 gets us close enough that we really don't need specialized syntax.
>>>
>>
>> It will still be a workaround and no new user will dare to try it. We
>> still have to teach it as a "convention", a trick.
>>
>
>
> But it *is* a trick, even with your syntax. With your way, you have to
> teach them that you can create parameters and arguments that don't look
> like parameters and arguments. Consistency is important, and new users will
> be a bit perplexed that `i, width: i` is somehow three parameters despite
> the lack of a comma.
>
> New users would learn it as convention, as style, not as "colon-identifers
> become parameters". That's a detail they will not absorb. Which means
> they're going to be really confused when they see `auto val = width:;`.
> They won't have any idea what to make of that, and how can you blame them.
>
> Just look at the inconsistency in the function declaration compared to its
> actual type. `void func(width: int i)` has no comma to separate the two
> parameters. `void(decltype(width:), int i)` does have a comma.
>
> Regularity is one of the most important things that make a language
> teachable. Clever syntax allows new users to pick something up quickly. But
> the thing that makes it easiest for them to matriculate from new user to
> skilled user is *regularity*. A regular language is one where you never
> have to lie to them when they're new users. Where, when they learn a thing,
> they learn it correctly and entirely, even as a new user. And that's what
> you're doing here when your colon identifiers don't have commas between
> them and the next parameter.
>
> Now if your syntax were `func(:width:, i)`, that would at least be
> consistent with other arguments. I know that a goal of your syntax is to
> make them not appear to be parameters, but that's a bad goal. If something
> is a parameter, it should look like any other parameter.
>
> Overall, my point is this: the need for this feature is not great enough
> for it to take up special syntax and have special meaning. I recognize that
> it is useful, but it is not sufficiently broadly useful for it to absorb
> syntax. Especially with such inconsistent syntax.
>
I don't hold strong opinion on that. I know this much -
- disambiguation of functions of the same types is needed - to use
different types only goes so far, to use different names only goes so far.
- Current way is expert only and is obvious trick.
- However, the idea to use a special argument is sound (the best) - it
is the least intrusive to the implementation.
- Because the requirements of such types are very, very narrow, they
should be able to be created by the compiler
- To have these arguments know to the compiler will greatly improve
error messages, diagnostics, probably refactor
Let's see real word case
template< class ExecutionPolicy, class ForwardIt, class UnaryPredicate >
ForwardIt find( ExecutionPolicy&& policy, ForwardIt first, ForwardIt last,
const T& value );
And
sequenced_policy
parallel_policy
parallel_unsequenced_policy
And then all
seq
par
par_unseq
And then even
is_execution_policy
This is a prime example of "C++ is experts-only"! No to mention it
impossible to use the API without documentation!
So, yea *I want this done for me*, and improved, so anyone can use it! An
idiom becomes a feature.
It is obvious, we can improve, automate this, so the kid can create Rects
from any starting point, on the same week it learns about overloading.
No need to teach it about tag idioms, empty classes, global variables,
namespaces - it must be able to express the idea *in terms of the function
declaration alone.*
No matter the syntax, but some new syntax is well worth it as it is
enabling technology that *anyone* can take advantage of.
There is nothing expert-level about the need for it, but the cost of
implementing it is high.
I think of this in the same vain as structured bindings:
C++ does not have multiple return types, and boom - now it does
C++ does not have named constructors - boom, now it does.
Yes both are possible without sugar, but a sugar makes an idiom a core
feature!
In any case I am open to ideas, but the goal is noble as we have the tools
already - we just need better packaging.
--
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/cd27cb99-c241-4bd7-bcd8-66c0f7ebfa7b%40isocpp.org.
------=_Part_78452_1211517455.1531236965426
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Tuesday, July 10, 2018 at 4:54:23 PM UTC+3, Nic=
ol Bolas 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=
"><br><br>On Tuesday, July 10, 2018 at 5:18:22 AM UTC-4, <a>mihailn...@gmai=
l.com</a> 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"><b=
r><br>On Tuesday, July 10, 2018 at 12:52:46 AM UTC+3, Nicol Bolas wrote:<bl=
ockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-l=
eft:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">On Monday, July 9, 20=
18 at 6:00:59 AM UTC-4, <a>mihailn...@gmail.com</a> 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><span style=3D"text-align:left=
;color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:nor=
mal;font-size:13px;font-style:normal;font-variant:normal;font-weight:400;te=
xt-decoration:none;word-spacing:0px;display:inline!important;white-space:no=
rmal;float:none;background-color:transparent"><font face=3D"arial,sans-seri=
f">Basically we can have beautiful and teachable interfaces and the tag sta=
ys as implementation detail.</font></span></div></div></blockquote><div><br=
></div><div>But it's <i>not</i> an "implementation detail".</=
div><div><br></div><div>Can I pass `func` to a `std::function<void(int)&=
gt;`? I rather suspect not. Indeed, overloading aside, what would `&fun=
c` return? It would have to be a `void(*)(tag_type<"width">=
, int)`, right? So it's hardly an implementation detail; it changes the=
signature of the function.</div><div><br></div><div>This kind of design re=
minds me of the Coroutines TS: it start with a syntax and preferred behavio=
r, then does whatever it takes to make that syntax have the preferred behav=
ior. Comparatively, the Core Corotines proposal is about providing mechanis=
ms which can be used to implement the preferred behavior.</div><div><br></d=
iv><div>What I mean is this: your proposal is really three related mechanis=
ms. The first is a way to convert an identifier into a type. The second is =
a way to pass this identifier/type as a function parameter so that it doesn=
't look like a function parameter at all. And the third is a way to dec=
lare a function that receives this identifier/type as a function parameter,=
but not using regular function parameter syntax.</div><div><br></div><div>=
I would much rather see this broken down into individual mechanisms. For ex=
ample, why does it <i>need</i> to be an identifier? If the calling code wer=
e:</div></div></blockquote><div><br></div><div>Once we break things down, w=
e are back at were we started.<br></div></div></blockquote><div><br></div><=
div>Which is the point: if you properly break down a feature, and it turns =
out that it doesn't buy you much at all... then why do you need it? I h=
ave a strong dislike for bulldozer language design, where you have a way yo=
u want people's code to look, and you run a bulldozer through anything =
that gets in the way. Sometimes, it is necessary and it does produce elegan=
t code. But it also creates inflexible code, creating lots of one-off synta=
x that can only ever be used for one thing.<br></div><div><br></div><div>I =
prefer mechanisms to policies. Let's give users to tools to create the =
policies they want.<br></div><div><br></div><blockquote class=3D"gmail_quot=
e" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-l=
eft:1ex"><div dir=3D"ltr"><div></div><div></div><blockquote class=3D"gmail_=
quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;paddi=
ng-left:1ex"><div dir=3D"ltr"><div></div><div><div style=3D"background-colo=
r:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-=
width:1px"><code><div><span style=3D"color:#000">func</span><span style=3D"=
color:#660">(</span><span style=3D"color:#080">"width"</span><spa=
n style=3D"color:#660">,</span><span style=3D"color:#000"> width</span><spa=
n style=3D"color:#660">);</span></div></code></div><br></div><div></div><di=
v>Would that be so awful? Is the specialized syntax absolutely <i>necessary=
</i>? Because if we don't need that, then we can get that "right n=
ow" with C++20's ability to have strings as type parameters:</div>=
<div><br></div><div><div style=3D"background-color:rgb(250,250,250);border-=
color:rgb(187,187,187);border-style:solid;border-width:1px"><code><div><spa=
n style=3D"color:#000">func</span><span style=3D"color:#660">(</span><span =
style=3D"color:#080">"width"</span><span style=3D"color:#000">tag=
</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> width=
</span><span style=3D"color:#660">);</span></div></code></div></div><div><b=
r></div><div>Where `tag` is a UDL which converts the given string into a `f=
unc_tag` type.</div><div><br></div></div></blockquote><div><br></div><div>B=
TW, I am no longer sure we need strings</div><div><br></div><div><font face=
=3D"courier new,monospace">class width_tag {};</font></div><div><font face=
=3D"courier new,monospace"><br></font></div><div>should be enough.</div></d=
iv></blockquote><div><br></div></div></blockquote><div>=C2=A0</div><blockqu=
ote 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></div><div>That =
opens up a can of worms. What namespace is that in (and FYI: the global nam=
espace is the <i>wrong answer</i>)? Can you `export` it into a module? Does=
it get `import`ed it? What happens if there's already a type of that n=
ame declared in that namespace elsewhere?<br></div><div><br></div><div>If i=
t's a standard library template that gets instantiated, then all of tho=
se questions go away.<br></div></div></blockquote><div>=C2=A0</div><div>Sur=
e, it must be investigated I am not focusing on the impl too much right now=
..</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 d=
ir=3D"ltr"><div></div><div><br></div><blockquote class=3D"gmail_quote" styl=
e=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex=
"><div dir=3D"ltr"><div>Strings will be quite heavy, error prone ("wid=
ht") and we don't really need to parse these in compile time, not =
to motion any raw tag will be invisible to the tools, and we want tools to =
know about the function as much as possible</div></div></blockquote><div><b=
r></div><div>It will be as invisible to tools as the tools want them to be.=
That's the point of putting things in the standard library; they becom=
e <i>standard</i>.<br></div><div><br></div><blockquote class=3D"gmail_quote=
" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-le=
ft:1ex"><div dir=3D"ltr"><div>Also, don't forget templated labels! std:=
:any, std::variant both use them!</div><div><br></div><div>But no matter th=
e syntax, it should be first class citizen (syntax highlight, auto-completi=
on, improved error report etc ) and must feel natural:</div><div><br></div>=
<div><font face=3D"courier new,monospace">std::find(begin, end, if: []{ /*.=
...*/ });</font></div><div><font face=3D"courier new,monospace">std::find(be=
gin, end, if_not: []{ /*...*/ });</font></div></div></blockquote><div>=C2=
=A0</div><div>... No. Really, no. There's no reason why we shouldn'=
t have that for something that could easily be part of the function's <=
i>name</i>. Or better yet, simply negating the condition.</div><div><br></d=
iv></div></blockquote><div>=C2=A0</div><blockquote class=3D"gmail_quote" st=
yle=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-lef=
t: 1ex;"><div dir=3D"ltr"><div></div><div>What generic code needs to do thi=
s? The difference between `find_if` and `find_if_not` is literally just a n=
egation on the return value of the functor. With C++11 lambdas, there's=
no excuse for you not doing that negation yourself.</div></div></blockquot=
e><div><br></div><div>It was just an illustration and the point was more fi=
nd vs find_if, where it becomes more generic, not find_if vs find_if_not! =
=C2=A0</div><div><br></div><blockquote class=3D"gmail_quote" style=3D"margi=
n: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><di=
v dir=3D"ltr"><div>=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"m=
argin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div=
dir=3D"ltr"><div>Also allowed should be only the least amount of case labe=
ls, need to disambiguate - this will prevent syntax maniacs to label every =
argument! <br></div></div></blockquote><blockquote class=3D"gmail_quote" st=
yle=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1=
ex"><div dir=3D"ltr"><div>In other words <font face=3D"courier new,monospac=
e">fill_n </font>will NOT be allowed to be rewritten in terms of case label=
s!<br></div></div></blockquote><div><br></div><div>... how are you going to=
<i>stop</i> someone from doing that? I mean, it's not like they can re=
declare other people's functions with these; they'd have to be writ=
ing their own `fill_n`. And we're not going to rewrite the standard lib=
rary algorithms for a <i>third time</i> just for this nonsense.<br></div></=
div></blockquote><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></div><div>So if someone's writing their ow=
n fill_n, how are you going to stop them from just calling it `fill` and us=
ing a label?<br></div></div></blockquote><div><br></div><div>I really hope,=
there is a way. Otherwise they will be abused for horrible APIs with doubl=
e mount of arguments, a total mess.</div><div>If it is not possible, then i=
t will be better to pretend these are arguments - with a lot of automatic b=
ehavior like the hidden type, usage-is-declaration and so on</div><div><br>=
</div><div>To just label arguments, not to create a new overload, a weak na=
med arguments must be used that do not introduce arguments, don't chang=
e the signature and are optional.</div><div>These are different, a differen=
t topic altogether.</div><div><br></div><div>=C2=A0</div><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></div><div>=C2=A0</div><b=
lockquote 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></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></div><div>Now sure, when you declare the function, you have to i=
nclude a bit of cruft. But quite frankly, tagged parameters of this sort sh=
ould not be so common that such cruft appears frequently in code. This is m=
ainly for one-off cases like top-left vs. bottom-left rectangle coordinates=
.. For something like angles, you genuinely want to wrap the number in a rea=
l type (since it involves units).</div><div><br></div><div>C++20 gets us cl=
ose enough that we really don't need specialized syntax.<br></div></div=
></blockquote><div><br></div><div>It will still be a workaround and no new =
user will dare to try it. We still have to teach it as a "convention&q=
uot;, a trick.=C2=A0</div></div></blockquote><div><br></div></div></blockqu=
ote><div>=C2=A0</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></div><div>But it <i>is</i> a trick, even with your syntax. W=
ith your way, you have to teach them that you can create parameters and arg=
uments that don't look like parameters and arguments. Consistency is im=
portant, and new users will be a bit perplexed that `i, width: i` is someho=
w three parameters despite the lack of a comma.</div><div><br></div><div>Ne=
w users would learn it as convention, as style, not as "colon-identife=
rs become parameters". That's a detail they will not absorb. Which=
means they're going to be really confused when they see `auto val =3D =
width:;`. They won't have any idea what to make of that, and how can yo=
u blame them.<br></div><div><br></div><div>Just look at the inconsistency i=
n the function declaration compared to its actual type. `void func(width: i=
nt i)` has no comma to separate the two parameters. `void(decltype(width:),=
int i)` does have a comma.</div><div><br></div><div>Regularity is one of t=
he most important things that make a language teachable. Clever syntax allo=
ws new users to pick something up quickly. But the thing that makes it easi=
est for them to matriculate from new user to skilled user is <i>regularity<=
/i>. A regular language is one where you never have to lie to them when the=
y're new users. Where, when they learn a thing, they learn it correctly=
and entirely, even as a new user. And that's what you're doing her=
e when your colon identifiers don't have commas between them and the ne=
xt parameter.<br></div><div><br></div>Now if your syntax were `func(:width:=
, i)`, that would at least be consistent with other arguments. I know that =
a goal of your syntax is to make them not appear to be parameters, but that=
's a bad goal. If something is a parameter, it should look like any oth=
er parameter.<div><br></div><div>Overall, my point is this: the need for th=
is feature is not great enough for it to take up special syntax and have sp=
ecial meaning. I recognize that it is useful, but it is not sufficiently br=
oadly useful for it to absorb syntax. Especially with such inconsistent syn=
tax.<br></div></div></blockquote><div><br></div><div>I don't hold stron=
g opinion on that. I know this much -=C2=A0</div><ul><li>disambiguation of =
functions of the same types is needed - to use different types only goes so=
far, to use different names only goes so far.=C2=A0</li><li>Current way is=
expert only and is obvious trick.=C2=A0</li><li>However, the idea to use a=
special argument is sound (the best) - it is the least intrusive to the im=
plementation.</li><li>Because the requirements of such types are very, very=
narrow, they should be able to be created by the compiler=C2=A0</li><li>To=
have these arguments know to the compiler will greatly improve error messa=
ges, diagnostics, probably refactor</li></ul><div>Let's see real word c=
ase</div><div><div style=3D"background-color: transparent; border-bottom-co=
lor: rgb(34, 34, 34); border-bottom-style: none; border-bottom-width: 0px; =
border-image-outset: 0; border-image-repeat: stretch; border-image-slice: 1=
00%; border-image-source: none; border-image-width: 1; border-left-color: r=
gb(34, 34, 34); border-left-style: none; border-left-width: 0px; border-rig=
ht-color: rgb(34, 34, 34); border-right-style: none; border-right-width: 0p=
x; border-top-color: rgb(34, 34, 34); border-top-style: none; border-top-wi=
dth: 0px; color: rgb(34, 34, 34); font-family: &quot;Arial&quot;,&a=
mp;quot;Helvetica&quot;,sans-serif; 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;"><br style=3D"background-attachment: scroll; background-clip: borde=
r-box; background-color: transparent; background-image: none; background-or=
igin: padding-box; background-position-x: 0%; background-position-y: 0%; ba=
ckground-repeat: repeat; background-size: auto; border-bottom-color: rgb(34=
, 34, 34); border-bottom-style: none; border-bottom-width: 0px; border-imag=
e-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: r=
gb(34, 34, 34); border-right-style: none; border-right-width: 0px; border-t=
op-color: rgb(34, 34, 34); border-top-style: none; border-top-width: 0px; c=
olor: rgb(34, 34, 34); font-family: &quot;Arial&quot;,&quot;Hel=
vetica&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; overflow-x: visible; overflow-y: visible; padding-bottom=
: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"></div><fon=
t face=3D"courier new,monospace" 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: courier new,mo=
nospace; font-size: 13px; font-style: normal; font-variant: normal; font-we=
ight: 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; ma=
rgin-right: 0px; margin-top: 0px; orphans: 2; padding-bottom: 0px; padding-=
left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; text-dec=
oration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-=
width: 0px; white-space: normal; word-spacing: 0px;">template< class Exe=
cutionPolicy, class ForwardIt, class UnaryPredicate ></font><div style=
=3D"background-color: transparent; border-bottom-color: rgb(34, 34, 34); bo=
rder-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, 34); border-l=
eft-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&qu=
ot;,sans-serif; 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; p=
adding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; t=
ext-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-=
stroke-width: 0px; white-space: normal; word-spacing: 0px;"><font face=3D"c=
ourier new,monospace" style=3D"border-bottom-color: rgb(34, 34, 34); border=
-bottom-style: none; border-bottom-width: 0px; border-image-outset: 0; bord=
er-image-repeat: stretch; border-image-slice: 100%; border-image-source: no=
ne; 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); b=
order-right-style: none; border-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; padding-right: 0px; padding-top: 0px;"> ForwardIt find=
( ExecutionPolicy&& policy, ForwardIt first, ForwardIt last, const =
T& value );</font></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;"><font face=3D"courier new,monospace" style=3D"border=
-bottom-color: rgb(34, 34, 34); border-bottom-style: none; border-bottom-wi=
dth: 0px; border-image-outset: 0; border-image-repeat: stretch; border-imag=
e-slice: 100%; border-image-source: none; border-image-width: 1; border-lef=
t-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; bor=
der-top-width: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px=
; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0=
px; padding-top: 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: courier new,monospace; fo=
nt-size: 13px; height: auto; margin-bottom: 0px; margin-left: 0px; margin-r=
ight: 0px; margin-top: 0px; min-width: 0px; overflow: visible; overflow-x: =
visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; paddi=
ng-right: 0px; padding-top: 0px;"></font></div><div style=3D"background-col=
or: transparent; border-bottom-color: rgb(34, 34, 34); border-bottom-style:=
none; border-bottom-width: 0px; border-image-outset: 0; border-image-repea=
t: stretch; border-image-slice: 100%; border-image-source: none; border-ima=
ge-width: 1; border-left-color: rgb(34, 34, 34); border-left-style: none; b=
order-left-width: 0px; border-right-color: rgb(34, 34, 34); border-right-st=
yle: none; border-right-width: 0px; border-top-color: rgb(34, 34, 34); bord=
er-top-style: none; border-top-width: 0px; color: rgb(34, 34, 34); font-fam=
ily: &quot;Arial&quot;,&quot;Helvetica&quot;,sans-serif; fo=
nt-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-decoration: no=
ne; text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px;=
white-space: normal; word-spacing: 0px;"><font face=3D"arial,sans-serif" s=
tyle=3D"border-bottom-color: rgb(34, 34, 34); border-bottom-style: none; bo=
rder-bottom-width: 0px; border-image-outset: 0; border-image-repeat: stretc=
h; border-image-slice: 100%; border-image-source: none; border-image-width:=
1; border-left-color: rgb(34, 34, 34); border-left-style: none; border-lef=
t-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-st=
yle: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px; mar=
gin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; pa=
dding-right: 0px; padding-top: 0px;">And=C2=A0</font></div><div style=3D"ba=
ckground-color: transparent; border-bottom-color: rgb(34, 34, 34); border-b=
ottom-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, 34); border-left-st=
yle: none; border-left-width: 0px; border-right-color: rgb(34, 34, 34); bor=
der-right-style: none; border-right-width: 0px; border-top-color: rgb(34, 3=
4, 34); border-top-style: none; border-top-width: 0px; color: rgb(34, 34, 3=
4); font-family: &quot;Arial&quot;,&quot;Helvetica&quot;,sa=
ns-serif; font-size: 13px; font-style: normal; font-variant: normal; font-w=
eight: 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px; m=
argin-right: 0px; margin-top: 0px; orphans: 2; padding-bottom: 0px; padding=
-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; text-de=
coration: 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-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; margin-bottom: 0px; marg=
in-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padd=
ing-left: 0px; padding-right: 0px; padding-top: 0px;"><font face=3D"arial,s=
ans-serif" style=3D"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; margin-bottom: 0px; margin-le=
ft: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-l=
eft: 0px; padding-right: 0px; padding-top: 0px;"></font><br style=3D"backgr=
ound-attachment: scroll; background-clip: border-box; background-color: tra=
nsparent; background-image: none; background-origin: padding-box; backgroun=
d-position-x: 0%; background-position-y: 0%; background-repeat: repeat; bac=
kground-size: auto; 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: courier new,monospace; 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-bott=
om: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"></font><=
/div><div style=3D"background-color: transparent; border-bottom-color: rgb(=
34, 34, 34); border-bottom-style: none; border-bottom-width: 0px; border-im=
age-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; bord=
er-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;H=
elvetica&quot;,sans-serif; font-size: 13px; font-style: normal; font-va=
riant: 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-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-width: 0px; border-image-=
outset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-i=
mage-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; mar=
gin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padd=
ing-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">=
sequenced_policy<br style=3D"background-attachment: scroll; background-clip=
: border-box; background-color: transparent; background-image: none; backgr=
ound-origin: padding-box; background-position-x: 0%; background-position-y:=
0%; background-repeat: repeat; background-size: auto; 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: courier new,monospace; font-size=
: 13px; height: auto; margin-bottom: 0px; margin-left: 0px; margin-right: 0=
px; margin-top: 0px; min-width: 0px; overflow: visible; overflow-x: visible=
; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padding-righ=
t: 0px; padding-top: 0px;">parallel_policy<br style=3D"background-attachmen=
t: scroll; background-clip: border-box; background-color: transparent; back=
ground-image: none; background-origin: padding-box; background-position-x: =
0%; background-position-y: 0%; background-repeat: repeat; background-size: =
auto; 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: courie=
r new,monospace; font-size: 13px; height: auto; margin-bottom: 0px; margin-=
left: 0px; margin-right: 0px; margin-top: 0px; min-width: 0px; overflow: vi=
sible; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; paddi=
ng-left: 0px; padding-right: 0px; padding-top: 0px;"><div style=3D"border-b=
ottom-color: rgb(34, 34, 34); border-bottom-style: none; border-bottom-widt=
h: 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; bo=
rder-right-color: rgb(34, 34, 34); border-right-style: none; border-right-w=
idth: 0px; border-top-color: rgb(34, 34, 34); border-top-style: none; borde=
r-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;">parallel_unsequenced_policy</div><div 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;"><br style=3D"background-attachment: scroll; backgroun=
d-clip: border-box; background-color: transparent; background-image: none; =
background-origin: padding-box; background-position-x: 0%; background-posit=
ion-y: 0%; background-repeat: repeat; background-size: auto; 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, 34); border-left-style: none; border-left-width: 0px; border-r=
ight-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: courier new,monospace; fon=
t-size: 13px; height: auto; margin-bottom: 0px; margin-left: 0px; margin-ri=
ght: 0px; margin-top: 0px; min-width: 0px; overflow: visible; overflow-x: v=
isible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; paddin=
g-right: 0px; padding-top: 0px;"></div><div style=3D"border-bottom-color: r=
gb(34, 34, 34); border-bottom-style: none; border-bottom-width: 0px; border=
-image-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; b=
order-image-source: none; border-image-width: 1; border-left-color: rgb(34,=
34, 34); border-left-style: none; border-left-width: 0px; border-right-col=
or: rgb(34, 34, 34); border-right-style: none; border-right-width: 0px; bor=
der-top-color: rgb(34, 34, 34); border-top-style: none; border-top-width: 0=
px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0p=
x; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top:=
0px;"><font face=3D"arial,sans-serif" style=3D"border-bottom-color: rgb(34=
, 34, 34); border-bottom-style: none; border-bottom-width: 0px; border-imag=
e-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: r=
gb(34, 34, 34); border-right-style: none; border-right-width: 0px; border-t=
op-color: rgb(34, 34, 34); border-top-style: none; border-top-width: 0px; m=
argin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; pa=
dding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;=
">And then all</font></div><div style=3D"border-bottom-color: rgb(34, 34, 3=
4); border-bottom-style: none; border-bottom-width: 0px; border-image-outse=
t: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-=
source: none; border-image-width: 1; border-left-color: rgb(34, 34, 34); bo=
rder-left-style: none; border-left-width: 0px; border-right-color: rgb(34, =
34, 34); border-right-style: none; border-right-width: 0px; border-top-colo=
r: rgb(34, 34, 34); border-top-style: none; border-top-width: 0px; margin-b=
ottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-b=
ottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><font=
face=3D"arial,sans-serif" 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;"></font><br=
style=3D"background-attachment: scroll; background-clip: border-box; backg=
round-color: transparent; background-image: none; background-origin: paddin=
g-box; background-position-x: 0%; background-position-y: 0%; background-rep=
eat: repeat; background-size: auto; 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; color: rgb(34=
, 34, 34); font-family: courier new,monospace; font-size: 13px; height: aut=
o; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px=
; min-width: 0px; overflow: visible; overflow-x: visible; overflow-y: visib=
le; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top=
: 0px;"></div><div style=3D"border-bottom-color: rgb(34, 34, 34); border-bo=
ttom-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, 34); border-left-sty=
le: none; border-left-width: 0px; border-right-color: rgb(34, 34, 34); bord=
er-right-style: none; border-right-width: 0px; border-top-color: rgb(34, 34=
, 34); border-top-style: none; border-top-width: 0px; margin-bottom: 0px; m=
argin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; p=
adding-left: 0px; padding-right: 0px; padding-top: 0px;">seq<br style=3D"ba=
ckground-attachment: scroll; background-clip: border-box; background-color:=
transparent; background-image: none; background-origin: padding-box; backg=
round-position-x: 0%; background-position-y: 0%; background-repeat: repeat;=
background-size: auto; 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; color: rgb(34, 34, 34); f=
ont-family: courier new,monospace; font-size: 13px; height: auto; margin-bo=
ttom: 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; padding-top: 0px;">par<=
br style=3D"background-attachment: scroll; background-clip: border-box; bac=
kground-color: transparent; background-image: none; background-origin: padd=
ing-box; background-position-x: 0%; background-position-y: 0%; background-r=
epeat: repeat; background-size: auto; 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: courier new,monospace; font-size: 13px; height: a=
uto; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0=
px; min-width: 0px; overflow: visible; overflow-x: visible; overflow-y: vis=
ible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-t=
op: 0px;">par_unseq</div></font><div 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-i=
mage-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; mar=
gin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padd=
ing-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">=
<font face=3D"arial,sans-serif" style=3D"border-bottom-color: rgb(34, 34, 3=
4); border-bottom-style: none; border-bottom-width: 0px; border-image-outse=
t: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-=
source: none; border-image-width: 1; border-left-color: rgb(34, 34, 34); bo=
rder-left-style: none; border-left-width: 0px; border-right-color: rgb(34, =
34, 34); border-right-style: none; border-right-width: 0px; border-top-colo=
r: rgb(34, 34, 34); border-top-style: none; border-top-width: 0px; margin-b=
ottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-b=
ottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"></fon=
t><br style=3D"background-attachment: scroll; background-clip: border-box; =
background-color: transparent; background-image: none; background-origin: p=
adding-box; background-position-x: 0%; background-position-y: 0%; backgroun=
d-repeat: repeat; background-size: auto; border-bottom-color: rgb(34, 34, 3=
4); border-bottom-style: none; border-bottom-width: 0px; border-image-outse=
t: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-=
source: none; border-image-width: 1; border-left-color: rgb(34, 34, 34); bo=
rder-left-style: none; border-left-width: 0px; border-right-color: rgb(34, =
34, 34); border-right-style: none; border-right-width: 0px; border-top-colo=
r: rgb(34, 34, 34); border-top-style: none; border-top-width: 0px; color: r=
gb(34, 34, 34); font-family: &quot;Arial&quot;,&quot;Helvetica&=
amp;quot;,sans-serif; font-size: 13px; height: auto; margin-bottom: 0px; ma=
rgin-left: 0px; margin-right: 0px; margin-top: 0px; min-width: 0px; overflo=
w: visible; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; =
padding-left: 0px; padding-right: 0px; padding-top: 0px;"></div><div 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;"><font face=3D"arial,sans-serif" style=3D"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; margin-bottom: 0px; margin-left: 0px; margin-right=
: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-rig=
ht: 0px; padding-top: 0px;">And then even</font></div><div 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 face=3D"arial,sans-serif" style=3D"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; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; marg=
in-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; pa=
dding-top: 0px;"><br style=3D"background-attachment: scroll; background-cli=
p: border-box; background-color: transparent; background-image: none; backg=
round-origin: padding-box; background-position-x: 0%; background-position-y=
: 0%; background-repeat: repeat; background-size: auto; border-bottom-color=
: rgb(34, 34, 34); border-bottom-style: none; border-bottom-width: 0px; bor=
der-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: arial,sans-serif; font-size: 13=
px; height: auto; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; =
margin-top: 0px; min-width: 0px; overflow: visible; overflow-x: visible; ov=
erflow-y: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0=
px; padding-top: 0px;"></font></div><div style=3D"border-bottom-color: rgb(=
34, 34, 34); border-bottom-style: none; border-bottom-width: 0px; border-im=
age-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; bord=
er-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;=
margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; =
padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0p=
x;"><font style=3D"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; margin-bottom: 0px; margin-lef=
t: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-le=
ft: 0px; padding-right: 0px; padding-top: 0px;"><span style=3D"background-c=
olor: transparent; border-bottom-color: rgb(0, 0, 0); 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(0, 0, 0); border-left-style: none; borde=
r-left-width: 0px; border-right-color: rgb(0, 0, 0); border-right-style: no=
ne; border-right-width: 0px; border-top-color: rgb(0, 0, 0); border-top-sty=
le: none; border-top-width: 0px; color: rgb(0, 0, 0); display: inline; floa=
t: none; font-family: DejaVuSansMono,&quot;DejaVu Sans Mono&quot;,c=
ourier,monospace; font-size: 12.8px; font-style: normal; font-variant: norm=
al; font-weight: 400; letter-spacing: normal; line-height: 14.08px; 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-tran=
sform: none; -webkit-text-stroke-width: 0px; white-space: nowrap; word-spac=
ing: 0px;"><font face=3D"courier new,monospace">is_execution_policy</font><=
/span><span class=3D"sy4" style=3D"background-color: transparent; border-bo=
ttom-color: rgb(0, 128, 128); border-bottom-style: none; border-bottom-widt=
h: 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(0, 128, 128); border-left-style: none; border-left-width: 0px; b=
order-right-color: rgb(0, 128, 128); border-right-style: none; border-right=
-width: 0px; border-top-color: rgb(0, 128, 128); border-top-style: none; bo=
rder-top-width: 0px; color: rgb(0, 128, 128); font-size: 12.8px; font-style=
: normal; font-variant: normal; font-weight: 400; letter-spacing: normal; l=
ine-height: 14.08px; 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: nowrap; word-spacing: 0px;"></span><b style=3D"background: none;=
margin: 0px; padding: 0px; border: 0px rgb(34, 34, 34); border-image: none=
; height: auto; color: rgb(34, 34, 34); overflow: visible; font-size: 13px;=
overflow-x: visible; overflow-y: visible; min-width: 0px;"></b><i style=3D=
"background: none; margin: 0px; padding: 0px; border: 0px rgb(34, 34, 34); =
border-image: none; height: auto; color: rgb(34, 34, 34); overflow: visible=
; font-size: 13px; overflow-x: visible; overflow-y: visible; min-width: 0px=
;"></i><u style=3D"background: none; margin: 0px; padding: 0px; border: 0px=
rgb(34, 34, 34); border-image: none; height: auto; color: rgb(34, 34, 34);=
overflow: visible; font-size: 13px; overflow-x: visible; overflow-y: visib=
le; min-width: 0px;"></u><sub 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-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; margin-bot=
tom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bot=
tom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"></sub><=
sup style=3D"border-bottom-color: rgb(34, 34, 34); border-bottom-style: non=
e; border-bottom-width: 0px; border-image-outset: 0; border-image-repeat: s=
tretch; border-image-slice: 100%; border-image-source: none; border-image-w=
idth: 1; border-left-color: rgb(34, 34, 34); border-left-style: none; borde=
r-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-t=
op-style: none; border-top-width: 0px; margin-bottom: 0px; margin-left: 0px=
; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0p=
x; padding-right: 0px; padding-top: 0px;"></sup><strike style=3D"border-bot=
tom-color: rgb(34, 34, 34); border-bottom-style: none; border-bottom-width:=
0px; border-image-outset: 0; border-image-repeat: stretch; border-image-sl=
ice: 100%; border-image-source: none; border-image-width: 1; border-left-co=
lor: rgb(34, 34, 34); border-left-style: none; border-left-width: 0px; bord=
er-right-color: rgb(34, 34, 34); border-right-style: none; border-right-wid=
th: 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; ma=
rgin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; =
padding-top: 0px;"></strike><br style=3D"background: none; margin: 0px; pad=
ding: 0px; border: 0px rgb(34, 34, 34); border-image: none; height: auto; c=
olor: rgb(34, 34, 34); overflow: visible; font-size: 13px; overflow-x: visi=
ble; overflow-y: visible; min-width: 0px;"></font></div></div><div style=3D=
"background-color: transparent; border-bottom-color: rgb(34, 34, 34); borde=
r-bottom-style: none; border-bottom-width: 0px; border-image-outset: 0; bor=
der-image-repeat: stretch; border-image-slice: 100%; border-image-source: n=
one; 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: normal; font-variant: normal; fon=
t-weight: 400; letter-spacing: normal; margin-bottom: 0px; margin-left: 0px=
; margin-right: 0px; margin-top: 0px; orphans: 2; padding-bottom: 0px; padd=
ing-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; text=
-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-str=
oke-width: 0px; white-space: normal; word-spacing: 0px;"><i style=3D"backgr=
ound-attachment: scroll; background-clip: border-box; background-color: tra=
nsparent; background-image: none; background-origin: padding-box; backgroun=
d-position-x: 0%; background-position-y: 0%; background-repeat: repeat; bac=
kground-size: auto; 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; height: auto; margin-bottom: 0px; margin-left: 0px; margi=
n-right: 0px; margin-top: 0px; min-width: 0px; overflow: visible; overflow-=
x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; pa=
dding-right: 0px; padding-top: 0px;"></i><font face=3D"courier new,monospac=
e"></font><br style=3D"background-attachment: scroll; background-clip: bord=
er-box; background-color: transparent; background-image: none; background-o=
rigin: padding-box; background-position-x: 0%; background-position-y: 0%; b=
ackground-repeat: repeat; background-size: auto; border-bottom-color: rgb(3=
4, 34, 34); border-bottom-style: none; border-bottom-width: 0px; border-ima=
ge-outset: 0; border-image-repeat: stretch; border-image-slice: 100%; borde=
r-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;He=
lvetica&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; overflow-x: visible; overflow-y: visible; padding-botto=
m: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"></div><di=
v style=3D"margin: 0px; padding: 0px; border: 0px rgb(34, 34, 34); border-i=
mage: none; text-align: left; color: rgb(34, 34, 34); text-transform: none;=
text-indent: 0px; letter-spacing: normal; font-size: 13px; font-variant: n=
ormal; font-weight: 400; text-decoration: none; word-spacing: 0px; white-sp=
ace: normal; orphans: 2; -webkit-text-stroke-width: 0px; background-color: =
transparent;">This is a prime example of "C++ is experts-only"! N=
o to mention it impossible to use the API without documentation!</div><div =
style=3D"margin: 0px; padding: 0px; border: 0px rgb(34, 34, 34); border-ima=
ge: none; text-align: left; color: rgb(34, 34, 34); text-transform: none; t=
ext-indent: 0px; letter-spacing: normal; font-size: 13px; font-variant: nor=
mal; font-weight: 400; text-decoration: none; word-spacing: 0px; white-spac=
e: normal; orphans: 2; -webkit-text-stroke-width: 0px; background-color: tr=
ansparent;"><br></div><b></b><u></u><sub></sub><sup></sup><strike></strike>=
So, yea <b>I want this done for me</b>, and improved, so anyone can use it!=
An idiom becomes a feature.</div><div><br></div><div>It is obvious, we can=
improve, automate this, so the kid can create Rects from any starting poin=
t, on the same week it learns about overloading.</div><div>No need to teach=
it about tag idioms, empty classes, global variables, namespaces - it must=
be able to express the idea <i>in terms of the function declaration alone.=
</i></div><div><br></div><div>No matter the syntax, but some new syntax is =
well worth it as it is enabling technology that <i>anyone</i> can take adva=
ntage of.=C2=A0</div><div>There is nothing expert-level about the need for =
it, but the cost of implementing it is high.</div><div><br></div><div>I thi=
nk of this in the same vain as structured bindings:</div><div>C++ does not =
have multiple return types, and boom - now it does</div><div>C++ does not h=
ave named constructors - boom, now it does.=C2=A0</div><div><br></div><div>=
Yes both are possible without sugar, but a sugar makes an idiom a core feat=
ure!=C2=A0</div><div><br></div><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;">In any case I am open to ideas, but the goal=
is noble as we have the tools already - we just need better packaging.=C2=
=A0</div><b></b><i></i><u></u><sub></sub><sup></sup><strike></strike><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/cd27cb99-c241-4bd7-bcd8-66c0f7ebfa7b%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/cd27cb99-c241-4bd7-bcd8-66c0f7ebfa7b=
%40isocpp.org</a>.<br />
------=_Part_78452_1211517455.1531236965426--
------=_Part_78451_896940243.1531236965425--
.
Author: mihailnajdenov@gmail.com
Date: Wed, 11 Jul 2018 01:51:00 -0700 (PDT)
Raw View
------=_Part_97573_157644504.1531299061065
Content-Type: multipart/alternative;
boundary="----=_Part_97574_1002512445.1531299061066"
------=_Part_97574_1002512445.1531299061066
Content-Type: text/plain; charset="UTF-8"
On Tuesday, July 10, 2018 at 4:54:23 PM UTC+3, Nicol Bolas wrote:
>
>
>
> On Tuesday, July 10, 2018 at 5:18:22 AM UTC-4, mihailn...@gmail.com wrote:
>>
>>
>>
>> On Tuesday, July 10, 2018 at 12:52:46 AM UTC+3, Nicol Bolas wrote:
>>>
>>> On Monday, July 9, 2018 at 6:00:59 AM UTC-4, mihailn...@gmail.com wrote:
>>>>
>>>> Basically we can have beautiful and teachable interfaces and the tag
>>>> stays as implementation detail.
>>>>
>>>
>>> But it's *not* an "implementation detail".
>>>
>>> Can I pass `func` to a `std::function<void(int)>`? I rather suspect not.
>>> Indeed, overloading aside, what would `&func` return? It would have to be a
>>> `void(*)(tag_type<"width">, int)`, right? So it's hardly an implementation
>>> detail; it changes the signature of the function.
>>>
>>> This kind of design reminds me of the Coroutines TS: it start with a
>>> syntax and preferred behavior, then does whatever it takes to make that
>>> syntax have the preferred behavior. Comparatively, the Core Corotines
>>> proposal is about providing mechanisms which can be used to implement the
>>> preferred behavior.
>>>
>>> What I mean is this: your proposal is really three related mechanisms.
>>> The first is a way to convert an identifier into a type. The second is a
>>> way to pass this identifier/type as a function parameter so that it doesn't
>>> look like a function parameter at all. And the third is a way to declare a
>>> function that receives this identifier/type as a function parameter, but
>>> not using regular function parameter syntax.
>>>
>>> I would much rather see this broken down into individual mechanisms. For
>>> example, why does it *need* to be an identifier? If the calling code
>>> were:
>>>
>>
>> Once we break things down, we are back at were we started.
>>
>
> Which is the point: if you properly break down a feature, and it turns out
> that it doesn't buy you much at all... then why do you need it? I have a
> strong dislike for bulldozer language design, where you have a way you want
> people's code to look, and you run a bulldozer through anything that gets
> in the way. Sometimes, it is necessary and it does produce elegant code.
> But it also creates inflexible code, creating lots of one-off syntax that
> can only ever be used for one thing.
>
> I prefer mechanisms to policies. Let's give users to tools to create the
> policies they want.
>
> func("width", width);
>>>
>>> Would that be so awful? Is the specialized syntax absolutely *necessary*?
>>> Because if we don't need that, then we can get that "right now" with
>>> C++20's ability to have strings as type parameters:
>>>
>>> func("width"tag, width);
>>>
>>> Where `tag` is a UDL which converts the given string into a `func_tag`
>>> type.
>>>
>>>
I think I know where the problem is - we don't need to express label
arguments in terms of a variable but in *terms of a type!*
Look:
rect(case topleft, Point p, Size sz); //< or whatever syntax
usage:
auto r = rect(topLeft: {}, {10, 10});
is transformed to
class topLeft {};
rect(topLeft, Point p , Size sz);
usage is transformed to :
auto r = rect(topLeft{}, {}, {10, 10});
Needles to say no objects are created - all is optimized the hell out. Any topLeft{}
== to any other topLeft{}
(Alternatively inline const auto topLeft_v = topLeft{}; could be introduced
and used when topLeft: is encountered in non-type context)
Best part - pointers, std::function<> all works, no decltype ever!
The only remaining part is to handle namespaces and generation rules.
Thoughts? Hints?
As for the syntax - I don't care about the declaration, but having the
possibility to use : instead of comma for the label on the usage site is *game
changer *in terms of readability and expressiveness
any(in_place<string>: 5, 'A');
This is a *massive* improvement as it is now clear we are opening a
sub-scope in which we put the arguments
Also
QImage(serializedData{}, data, size); //< aaa what?!?
QImage(with_serData, data, size); //< yuck
QImage(serializedData: data, size); //< beauty
On the call site a bit of syntax sugar is the difference b/w a trick and a
feature, much like structured bindings!
--
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/221052e3-727d-4917-a65b-9131c0bf69d2%40isocpp.org.
------=_Part_97574_1002512445.1531299061066
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Tuesday, July 10, 2018 at 4:54:23 PM UTC+3, Nic=
ol Bolas 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=
"><br><br>On Tuesday, July 10, 2018 at 5:18:22 AM UTC-4, <a>mihailn...@gmai=
l.com</a> 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"><b=
r><br>On Tuesday, July 10, 2018 at 12:52:46 AM UTC+3, Nicol Bolas wrote:<bl=
ockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-l=
eft:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">On Monday, July 9, 20=
18 at 6:00:59 AM UTC-4, <a>mihailn...@gmail.com</a> 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><span style=3D"text-align:left=
;color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:nor=
mal;font-size:13px;font-style:normal;font-variant:normal;font-weight:400;te=
xt-decoration:none;word-spacing:0px;display:inline!important;white-space:no=
rmal;float:none;background-color:transparent"><font face=3D"arial,sans-seri=
f">Basically we can have beautiful and teachable interfaces and the tag sta=
ys as implementation detail.</font></span></div></div></blockquote><div><br=
></div><div>But it's <i>not</i> an "implementation detail".</=
div><div><br></div><div>Can I pass `func` to a `std::function<void(int)&=
gt;`? I rather suspect not. Indeed, overloading aside, what would `&fun=
c` return? It would have to be a `void(*)(tag_type<"width">=
, int)`, right? So it's hardly an implementation detail; it changes the=
signature of the function.</div><div><br></div><div>This kind of design re=
minds me of the Coroutines TS: it start with a syntax and preferred behavio=
r, then does whatever it takes to make that syntax have the preferred behav=
ior. Comparatively, the Core Corotines proposal is about providing mechanis=
ms which can be used to implement the preferred behavior.</div><div><br></d=
iv><div>What I mean is this: your proposal is really three related mechanis=
ms. The first is a way to convert an identifier into a type. The second is =
a way to pass this identifier/type as a function parameter so that it doesn=
't look like a function parameter at all. And the third is a way to dec=
lare a function that receives this identifier/type as a function parameter,=
but not using regular function parameter syntax.</div><div><br></div><div>=
I would much rather see this broken down into individual mechanisms. For ex=
ample, why does it <i>need</i> to be an identifier? If the calling code wer=
e:</div></div></blockquote><div><br></div><div>Once we break things down, w=
e are back at were we started.<br></div></div></blockquote><div><br></div><=
div>Which is the point: if you properly break down a feature, and it turns =
out that it doesn't buy you much at all... then why do you need it? I h=
ave a strong dislike for bulldozer language design, where you have a way yo=
u want people's code to look, and you run a bulldozer through anything =
that gets in the way. Sometimes, it is necessary and it does produce elegan=
t code. But it also creates inflexible code, creating lots of one-off synta=
x that can only ever be used for one thing.<br></div><div><br></div><div>I =
prefer mechanisms to policies. Let's give users to tools to create the =
policies they want.<br></div><div><br></div><blockquote class=3D"gmail_quot=
e" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-l=
eft:1ex"><div dir=3D"ltr"><div></div><div></div><blockquote class=3D"gmail_=
quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;paddi=
ng-left:1ex"><div dir=3D"ltr"><div></div><div><div style=3D"background-colo=
r:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-=
width:1px"><code><div><span style=3D"color:#000">func</span><span style=3D"=
color:#660">(</span><span style=3D"color:#080">"width"</span><spa=
n style=3D"color:#660">,</span><span style=3D"color:#000"> width</span><spa=
n style=3D"color:#660">);</span></div></code></div><br></div><div></div><di=
v>Would that be so awful? Is the specialized syntax absolutely <i>necessary=
</i>? Because if we don't need that, then we can get that "right n=
ow" with C++20's ability to have strings as type parameters:</div>=
<div><br></div><div><div style=3D"background-color:rgb(250,250,250);border-=
color:rgb(187,187,187);border-style:solid;border-width:1px"><code><div><spa=
n style=3D"color:#000">func</span><span style=3D"color:#660">(</span><span =
style=3D"color:#080">"width"</span><span style=3D"color:#000">tag=
</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> width=
</span><span style=3D"color:#660">);</span></div></code></div></div><div><b=
r></div><div>Where `tag` is a UDL which converts the given string into a `f=
unc_tag` type.</div><div><br></div></div></blockquote></div></blockquote></=
div></blockquote><div><br></div><div><br></div><div>I think I know where th=
e problem is - we don't need to express label arguments in terms of a v=
ariable but in <i>terms of a type!</i></div><div><i></i><br></div><div>Look=
:</div><div><br></div><div><font face=3D"courier new,monospace">rect(case t=
opleft, Point p, Size sz); //< or whatever syntax</font></div><div><b></=
b><i></i><u></u><sub></sub><sup></sup><strike></strike><br></div><div>usage=
:</div><div><br></div><div><font face=3D"courier new,monospace">auto r =3D =
rect(topLeft: {}, {10, 10});=C2=A0</font></div><div><font face=3D"courier n=
ew,monospace"><br></font></div><div><font face=3D"arial,sans-serif"><br></f=
ont></div><div><font face=3D"arial,sans-serif">is transformed to=C2=A0</fon=
t></div><div><font face=3D"arial,sans-serif"><br></font></div><div><font fa=
ce=3D"courier new,monospace">class topLeft {};</font></div><div><font face=
=3D"courier new,monospace"><br></font></div><div><font face=3D"arial,sans-s=
erif"><span style=3D"display: inline !important; float: none; background-co=
lor: transparent; color: rgb(34, 34, 34); font-family: courier new,monospac=
e; 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: 0=
px; white-space: normal; word-spacing: 0px;">rect(topLeft, Point p , Size s=
z);</span></font></div><div><font face=3D"arial,sans-serif"><b></b><i></i><=
u></u><sub></sub><sup></sup><strike></strike><br></font></div><div><font fa=
ce=3D"arial,sans-serif"><span style=3D"display: inline !important; float: n=
one; background-color: transparent; color: rgb(34, 34, 34); font-family: &q=
uot;Arial","Helvetica",sans-serif; font-size: 13px; font-sty=
le: normal; font-variant: normal; font-weight: 400; letter-spacing: normal;=
orphans: 2; 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;">usage <span style=3D"display: inline !important; float: no=
ne; background-color: transparent; color: rgb(34, 34, 34); font-family: ari=
al,sans-serif; font-size: 13px; font-style: normal; font-variant: normal; f=
ont-weight: 400; letter-spacing: normal; orphans: 2; text-align: left; text=
-decoration: none; text-indent: 0px; text-transform: none; -webkit-text-str=
oke-width: 0px; white-space: normal; word-spacing: 0px;">is transformed to=
=C2=A0</span>:</span></font></div><div><font face=3D"arial,sans-serif"><b><=
/b><i></i><u></u><sub></sub><sup></sup><strike></strike><br></font></div><d=
iv><font face=3D"arial,sans-serif"><span style=3D"display: inline !importan=
t; float: none; background-color: transparent; color: rgb(34, 34, 34); font=
-family: courier new,monospace; font-size: 13px; font-style: normal; font-v=
ariant: 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;">a=
uto r =3D rect(topLeft{}, {}, {10, 10});</span></font></div><div><font face=
=3D"arial,sans-serif"><b></b><i></i><u></u><sub></sub><sup></sup><strike></=
strike><br></font></div><div><font face=3D"arial,sans-serif"><br></font></d=
iv><div><font face=3D"arial,sans-serif">Needles to say no objects are creat=
ed - all is optimized the hell out. Any <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;">topLeft{} =3D=3D <font face=3D"arial,sans-serif">to any other</font>=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;">topLeft{}</span></span></font></d=
iv><div><br></div><div><font face=3D"arial,sans-serif">(Alternatively <font=
face=3D"courier new,monospace">inline const auto</font> <span style=3D"dis=
play: 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: nor=
mal; 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;">topLeft_v =3D <span 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); display: inline; fl=
oat: none; font-family: courier new,monospace; 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;">topLeft{}; </span><font face=3D"arial,sans-serif">could be =
introduced and used when=C2=A0<span 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); display: inline; float: =
none; font-family: courier new,monospace; font-size: 13px; font-style: norm=
al; 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-decoration: none; text-indent: 0px; text-tran=
sform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spac=
ing: 0px;">topLeft: <font face=3D"arial,sans-serif">is encountered in non-t=
ype context)=C2=A0</font></span></font></span></font></div><div><font face=
=3D"arial,sans-serif"><br></font></div><div><font face=3D"arial,sans-serif"=
>Best part - pointers, std::function<> all works, no <font face=3D"co=
urier new,monospace">decltype</font> ever!=C2=A0</font></div><div><font fac=
e=3D"arial,sans-serif"><br></font></div><div><font face=3D"arial,sans-serif=
">The only remaining part is to handle namespaces and generation rules.</fo=
nt></div><div><font face=3D"arial,sans-serif"><br></font></div><div><font f=
ace=3D"arial,sans-serif">Thoughts? Hints?</font></div><div><font face=3D"ar=
ial,sans-serif"><br></font></div><div><font face=3D"arial,sans-serif"><br><=
/font></div><div><font face=3D"arial,sans-serif">As for the syntax - I don&=
#39;t care about the declaration, but having the possibility to use <font f=
ace=3D"courier new,monospace">:</font> instead of comma for the label on th=
e usage site is <i>game changer </i>in terms of readability and expressiven=
ess =C2=A0=C2=A0</font></div><div><font face=3D"arial,sans-serif"><br></fon=
t></div><div><font face=3D"courier new,monospace">any(in_place<string>=
;: 5, 'A');</font></div><div><font face=3D"courier new,monospace"><=
br></font></div><div><font face=3D"arial,sans-serif">This is a <i>massive</=
i> improvement as it is now clear we are opening a sub-scope in which we pu=
t the arguments</font></div><div><font face=3D"courier new,monospace"><font=
face=3D"arial,sans-serif"></font><br></font></div><div><font face=3D"arial=
,sans-serif">Also</font></div><div><font face=3D"arial,sans-serif"><br></fo=
nt></div><div><font face=3D"arial,sans-serif"><span style=3D"display: inlin=
e !important; float: none; background-color: transparent; color: rgb(34, 34=
, 34); font-family: courier new,monospace; font-size: 13px; font-style: nor=
mal; font-variant: normal; font-weight: 400; letter-spacing: normal; orphan=
s: 2; text-align: left; text-decoration: none; text-indent: 0px; text-trans=
form: none; -webkit-text-stroke-width: 0px; white-space: normal; word-spaci=
ng: 0px;">QImage(serializedData{}, data, size); //< aaa what?!?</span></=
font></div><div><br></div><div><font face=3D"arial,sans-serif"><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;">QImage(with_<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;">serData</span>, data, size); //< yuck</span></font></div><div><font =
face=3D"arial,sans-serif"><span style=3D"text-align: left; color: rgb(34, 3=
4, 34); text-transform: none; text-indent: 0px; letter-spacing: normal; fon=
t-family: courier new,monospace; font-size: 13px; font-variant: normal; wor=
d-spacing: 0px; display: inline !important; white-space: normal; orphans: 2=
; float: none; -webkit-text-stroke-width: 0px; background-color: transparen=
t;"><font face=3D"arial,sans-serif" style=3D"border-bottom-color: rgb(34, 3=
4, 34); border-bottom-style: none; border-bottom-width: 0px; border-image-o=
utset: 0; border-image-repeat: stretch; border-image-slice: 100%; border-im=
age-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; marg=
in-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; paddi=
ng-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><=
span style=3D"margin: 0px; padding: 0px; border: 0px rgb(34, 34, 34); borde=
r-image: none; text-align: left; color: rgb(34, 34, 34); text-transform: no=
ne; text-indent: 0px; letter-spacing: normal; font-family: courier new,mono=
space; font-size: 13px; font-style: normal; font-variant: normal; font-weig=
ht: 400; text-decoration: none; word-spacing: 0px; display: inline; white-s=
pace: normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; back=
ground-color: transparent;"><br></span></font></span></font></div><div><div=
style=3D"background-color: transparent; border-bottom-color: rgb(34, 34, 3=
4); border-bottom-style: none; border-bottom-width: 0px; border-image-outse=
t: 0; border-image-repeat: stretch; border-image-slice: 100%; border-image-=
source: none; border-image-width: 1; border-left-color: rgb(34, 34, 34); bo=
rder-left-style: none; border-left-width: 0px; border-right-color: rgb(34, =
34, 34); border-right-style: none; border-right-width: 0px; border-top-colo=
r: rgb(34, 34, 34); border-top-style: none; border-top-width: 0px; color: r=
gb(34, 34, 34); font-family: &quot;Arial&quot;,&quot;Helvetica&=
amp;quot;,sans-serif; font-size: 13px; font-style: normal; font-variant: no=
rmal; 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: l=
eft; text-decoration: none; text-indent: 0px; text-transform: none; -webkit=
-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;"><font fac=
e=3D"arial,sans-serif"><span style=3D"text-align: left; color: rgb(34, 34, =
34); text-transform: none; text-indent: 0px; letter-spacing: normal; font-f=
amily: courier new,monospace; font-size: 13px; font-variant: normal; word-s=
pacing: 0px; display: inline !important; white-space: normal; orphans: 2; f=
loat: none; -webkit-text-stroke-width: 0px; background-color: transparent;"=
></span></font><font face=3D"arial,sans-serif"><br></font></div></div><div>=
<font face=3D"arial,sans-serif"><span style=3D"display: inline !important; =
float: none; background-color: transparent; color: rgb(34, 34, 34); font-fa=
mily: courier new,monospace; font-size: 13px; font-style: normal; font-vari=
ant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-ali=
gn: left; text-decoration: none; text-indent: 0px; text-transform: none; -w=
ebkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">QIma=
ge(serializedData: data, size); //< beauty</span><br></font></div><div><=
font face=3D"courier new,monospace"><font face=3D"arial,sans-serif"></font>=
<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></font></div><div><font fa=
ce=3D"courier new,monospace"><br></font></div><div><font face=3D"arial,sans=
-serif">On the call site a bit of syntax sugar is the difference b/w a tric=
k and a feature, much like structured bindings!=C2=A0</font></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/221052e3-727d-4917-a65b-9131c0bf69d2%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/221052e3-727d-4917-a65b-9131c0bf69d2=
%40isocpp.org</a>.<br />
------=_Part_97574_1002512445.1531299061066--
------=_Part_97573_157644504.1531299061065--
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Wed, 11 Jul 2018 08:38:57 -0700 (PDT)
Raw View
------=_Part_75270_1990373281.1531323538003
Content-Type: multipart/alternative;
boundary="----=_Part_75271_218380461.1531323538003"
------=_Part_75271_218380461.1531323538003
Content-Type: text/plain; charset="UTF-8"
On Wednesday, July 11, 2018 at 4:51:01 AM UTC-4, mihailn...@gmail.com wrote:
>
> I think I know where the problem is - we don't need to express label
> arguments in terms of a variable but in *terms of a type!*
>
> Look:
>
> rect(case topleft, Point p, Size sz); //< or whatever syntax
>
> usage:
>
> auto r = rect(topLeft: {}, {10, 10});
>
>
> is transformed to
>
> class topLeft {};
>
> rect(topLeft, Point p , Size sz);
>
> usage is transformed to :
>
> auto r = rect(topLeft{}, {}, {10, 10});
>
>
>
I don't much like it, but I think it's moving in a useful direction.
Let's start with the function declaration syntax. I don't really see the
point of it.
So you're injecting a class into the outer scope. So... why aren't you
using `struct/class` as the keyword here? OK, yes, I know why; because that
already has a different meaning (thanks to C): `class topLect` is
equivalent to just `topLeft`, and changing that is problematic.
The issue with injection is just that... you're not buying much. The code
for these manifested types is ultimately trivial in size. So what's wrong
with people just writing it out and making their code look like regular
code?
Another problem with it reminds me of the debates surrounding returning
anonymous structures. The idea was only really useful when these structures
were one-offs, where there was exactly one function that returned that
struct. Well, it turns out that this is not the case a lot of times. While
having `map::insert` return `pair`s is obviously impenetrable in terms of
meaning, returning an anonymous struct isn't nearly as good as having it
return a *named* structure. Why? Because every overload of `insert` on *every
associative container* (ordered or not) needs to return the same struct
that has the same meaning.
So give it a *name* already.
And that's one of the issues I have here. `std::in_place_t<T>` is used by
several constructors across several objects. And because it isn't tied to
those specific constructors in any way, any code that needs similar
in-place construction functionality can employ it. The standard defines
other tags that it reuses frequently, like `allocator_arg_t` and the like.
Ones which non-standard library code can reuse to have the same meaning.
So your feature would only ever really be useful in cases where you're
dealing with a one-off tag. The problem is that one-offs sometimes... stop
being one-offs.
I don't contest that one-offs exist. My point is that they're sufficiently
rare that we don't need grammar just to handle them. And by creating
grammar just to handle them, you're encouraging the creation of one-offs
for non-one-off problems.
That's one of the advantages of the templated tag idea.
`std::func_tag<"text">` will always resolve down to the same type. So
multiple functions in different scopes and namespaces can share the same
tag.
---
Now, on to the next part: the usage syntax. This is where I think you've
stumbled onto something.
OK, so we have `topLeft:{}`. That looks like "create an object of a type".
But what is that colon doing there? Why can't you just use `topLeft{}`?
Scope.
*Presumably* (because you never explained what it actually does, so I have
to make assumptions), that colon performs some kind of reverse ADL. That
is, when you find several candidate overloads, you deduce the full name of
the type by matching the base names of the overloads with that one. Those
which don't match are culled. The one that does match now defines the
actual type.
That way, if you're calling a function in a namespace or nested class, you
don't have to do
`Namespace::OtherNamespace::func(Namespace::OtherNamespace::topLeft{})`.
And *that* is where we get to something that is potentially useful: the
ability to take a base name of an entity and use the surrounding context to
deduce the full pathname of that entity.
This has wider implications than just your use case. This could allow
`switch/case` operations over an `enum class` to no longer be required to
repeat the enumeration name at each `case` label (obviously you can't use
your `:` syntax if we want to allow that). And many other things can now be
simplified.
However, defining its behavior correctly is complicated, a complexity
approaching list initialization. It impacts function overload resolution,
which is a *titanic* can of worms. But if you can do it, and if you can
find a syntax other than `:`, it could be significant. You'd solve not only
this tag issue, but many other verbosity problems.
As for the syntax - I don't care about the declaration, but having the
> possibility to use : instead of comma for the label on the usage site is *game
> changer *in terms of readability and expressiveness
>
> any(in_place<string>: 5, 'A');
>
> This is a *massive* improvement as it is now clear we are opening a
> sub-scope in which we put the arguments
>
But that's a lie. There is no "sub-scope"; there is no concept of a
"sub-scope" in C++. No book on C++ will explain how "sub-scopes" work
because it does not exist.
There is only a *convention* that creates the *illusion* of such a
construct. The biggest trap new users fall into when learning anything is
believing that they understand something when they actually *don't*. Your
syntax encourages that; it makes them believe in a concept that doesn't
actually exist.
Conventions are fine. But conventions that make people believe in
falsehoods are not fine.
And personally, I fail to see how `any(in_place<string>, 5, 'A')` is any
harder to understand than your colon syntax. Remember: `in_place` is a
variable, not a type <https://en.cppreference.com/w/cpp/utility/in_place>.
Thanks to variable concepts, we no longer need the `{}` on tags.
You analogized your syntax with structured binding. And you're right; the
right bit of syntactic sugar can make some things significantly more
useful. But structured binding removed *lots* of syntax at every use of the
members. This is especially true of `tuple`-like types; all of those
`std::get<>` calls are huge and bulky. Structured binding pays for itself
in convenience.
Your syntax takes `{},` and replaces it with `:` (scoping issues aside).
The removal of two characters cannot even *begin* to compete with the
improvement that structured binding provides. And that's ignoring the
inconsistency it creates.
The scoping aspect of your proposal is interesting. Focus on that and ditch
the part with the parameter that doesn't look like a parameter.
--
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/24ffbe29-a25e-493f-b026-ace438266adc%40isocpp.org.
------=_Part_75271_218380461.1531323538003
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Wednesday, July 11, 2018 at 4:51:01 AM UTC-4, mihailn..=
..@gmail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;marg=
in-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"=
ltr"><div></div><div>I think I know where the problem is - we don't nee=
d to express label arguments in terms of a variable but in <i>terms of a ty=
pe!</i></div><div><i></i><br></div><div>Look:</div><div><br></div><div><fon=
t face=3D"courier new,monospace">rect(case topleft, Point p, Size sz); //&l=
t; or whatever syntax</font></div><div><b></b><i></i><u></u><sub></sub><sup=
></sup><strike></strike><br></div><div>usage:</div><div><br></div><div><fon=
t face=3D"courier new,monospace">auto r =3D rect(topLeft: {}, {10, 10});=C2=
=A0</font></div><div><font face=3D"courier new,monospace"><br></font></div>=
<div><font face=3D"arial,sans-serif"><br></font></div><div><font face=3D"ar=
ial,sans-serif">is transformed to=C2=A0</font></div><div><font face=3D"aria=
l,sans-serif"><br></font></div><div><font face=3D"courier new,monospace">cl=
ass topLeft {};</font></div><div><font face=3D"courier new,monospace"><br><=
/font></div><div><font face=3D"arial,sans-serif"><span style=3D"display:inl=
ine!important;float:none;background-color:transparent;color:rgb(34,34,34);f=
ont-family:courier new,monospace;font-size:13px;font-style:normal;font-vari=
ant:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decor=
ation:none;text-indent:0px;text-transform:none;white-space:normal;word-spac=
ing:0px">rect(topLeft, Point p , Size sz);</span></font></div><div><font fa=
ce=3D"arial,sans-serif"><b></b><i></i><u></u><sub></sub><sup></sup><strike>=
</strike><br></font></div><div><font face=3D"arial,sans-serif"><span style=
=3D"display:inline!important;float:none;background-color:transparent;color:=
rgb(34,34,34);font-family:"Arial","Helvetica",sans-seri=
f;font-size:13px;font-style:normal;font-variant:normal;font-weight:400;lett=
er-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text=
-transform:none;white-space:normal;word-spacing:0px">usage <span style=3D"d=
isplay:inline!important;float:none;background-color:transparent;color:rgb(3=
4,34,34);font-family:arial,sans-serif;font-size:13px;font-style:normal;font=
-variant:normal;font-weight:400;letter-spacing:normal;text-align:left;text-=
decoration:none;text-indent:0px;text-transform:none;white-space:normal;word=
-spacing:0px">is transformed to=C2=A0</span>:</span></font></div><div><font=
face=3D"arial,sans-serif"><b></b><i></i><u></u><sub></sub><sup></sup><stri=
ke></strike><br></font></div><div><font face=3D"arial,sans-serif"><span sty=
le=3D"display:inline!important;float:none;background-color:transparent;colo=
r:rgb(34,34,34);font-family:courier new,monospace;font-size:13px;font-style=
:normal;font-variant:normal;font-weight:400;letter-spacing:normal;text-alig=
n:left;text-decoration:none;text-indent:0px;text-transform:none;white-space=
:normal;word-spacing:0px">auto r =3D rect(topLeft{}, {}, {10, 10});</span><=
/font></div><div><font face=3D"arial,sans-serif"><b></b><i></i><u></u><sub>=
</sub><sup></sup><strike></strike><br></font></div><div><font face=3D"arial=
,sans-serif"><br></font></div></div></blockquote><div><br></div><div>I don&=
#39;t much like it, but I think it's moving in a useful direction.</div=
><div><br></div><div>Let's start with the function declaration syntax. =
I don't really see the point of it.</div><div><br></div><div>So you'=
;re injecting a class into the outer scope. So... why aren't you using =
`struct/class` as the keyword here? OK, yes, I know why; because that alrea=
dy has a different meaning (thanks to C): `class topLect` is equivalent to =
just `topLeft`, and changing that is problematic.</div><div><br></div><div>=
The issue with injection is just that... you're not buying much. The co=
de for these manifested types is ultimately trivial in size. So what's =
wrong with people just writing it out and making their code look like regul=
ar code?<br></div><div></div><div><br></div><div>Another problem with it re=
minds me of the debates surrounding returning anonymous structures. The ide=
a was only really useful when these structures were one-offs, where there w=
as exactly one function that returned that struct. Well, it turns out that =
this is not the case a lot of times. While having `map::insert` return `pai=
r`s is obviously impenetrable in terms of meaning, returning an anonymous s=
truct isn't nearly as good as having it return a <i>named</i> structure=
.. Why? Because every overload of `insert` on <i>every associative container=
</i> (ordered or not) needs to return the same struct that has the same mea=
ning.</div><div><br></div><div>So give it a <i>name</i> already.</div><div>=
<br></div><div>And that's one of the issues I have here. `std::in_place=
_t<T>` is used by several constructors across several objects. And be=
cause it isn't tied to those specific constructors in any way, any code=
that needs similar in-place construction functionality can employ it. The =
standard defines other tags that it reuses frequently, like `allocator_arg_=
t` and the like. Ones which non-standard library code can reuse to have the=
same meaning.</div><div><br></div><div>So your feature would only ever rea=
lly be useful in cases where you're dealing with a one-off tag. The pro=
blem is that one-offs sometimes... stop being one-offs.</div><div><br></div=
><div>I don't contest that one-offs exist. My point is that they're=
sufficiently rare that we don't need grammar just to handle them. And =
by creating grammar just to handle them, you're encouraging the creatio=
n of one-offs for non-one-off problems.</div><div><br></div><div>That's=
one of the advantages of the templated tag idea. `std::func_tag<"t=
ext">` will always resolve down to the same type. So multiple funct=
ions in different scopes and namespaces can share the same tag.</div><div><=
br></div><div>---</div><div><br></div><div>Now, on to the next part: the us=
age syntax. This is where I think you've stumbled onto something.</div>=
<div><br></div><div>OK, so we have `topLeft:{}`. That looks like "crea=
te an object of a type". But what is that colon doing there? Why can&#=
39;t you just use `topLeft{}`?</div><div><br></div><div>Scope.</div><div><b=
r></div><div><i>Presumably</i> (because you never explained what it actuall=
y does, so I have to make assumptions), that colon performs some kind of re=
verse ADL. That is, when you find several candidate overloads, you deduce t=
he full name of the type by matching the base names of the overloads with t=
hat one. Those which don't match are culled. The one that does match no=
w defines the actual type.</div><div><br></div><div>That way, if you're=
calling a function in a namespace or nested class, you don't have to d=
o `Namespace::OtherNamespace::func(Namespace::OtherNamespace::topLeft{})`.<=
/div><div><br></div><div>And <i>that</i> is where we get to something that =
is potentially useful: the ability to take a base name of an entity and use=
the surrounding context to deduce the full pathname of that entity.</div><=
div><br></div><div>This has wider implications than just your use case. Thi=
s could allow `switch/case` operations over an `enum class` to no longer be=
required to repeat the enumeration name at each `case` label (obviously yo=
u can't use your `:` syntax if we want to allow that). And many other t=
hings can now be simplified.</div><div><br></div><div>However, defining its=
behavior correctly is complicated, a complexity approaching list initializ=
ation. It impacts function overload resolution, which is a <i>titanic</i> c=
an of worms. But if you can do it, and if you can find a syntax other than =
`:`, it could be significant. You'd solve not only this tag issue, but =
many other verbosity problems.<br></div><div></div><div><br></div><blockquo=
te 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><font face=3D"ari=
al,sans-serif"></font></div><div><font face=3D"arial,sans-serif"></font></d=
iv><div><font face=3D"arial,sans-serif">As for the syntax - I don't car=
e about the declaration, but having the possibility to use <font face=3D"co=
urier new,monospace">:</font> instead of comma for the label on the usage s=
ite is <i>game changer </i>in terms of readability and expressiveness =C2=
=A0=C2=A0</font></div><div><font face=3D"arial,sans-serif"><br></font></div=
><div><font face=3D"courier new,monospace">any(in_place<string>: 5, &=
#39;A');</font></div><div><font face=3D"courier new,monospace"><br></fo=
nt></div><div><font face=3D"arial,sans-serif">This is a <i>massive</i> impr=
ovement as it is now clear we are opening a sub-scope in which we put the a=
rguments</font></div></div></blockquote><div><br></div><div>But that's =
a lie. There is no "sub-scope"; there is no concept of a "su=
b-scope" in C++. No book on C++ will explain how "sub-scopes"=
; work because it does not exist.</div><div><br></div><div>There is only a =
<i>convention</i> that creates the <i>illusion</i> of such a construct. The=
biggest trap new users fall into when learning anything is believing that =
they understand something when they actually <i>don't</i>. Your syntax =
encourages that; it makes them believe in a concept that doesn't actual=
ly exist.</div><div><br></div><div>Conventions are fine. But conventions th=
at make people believe in falsehoods are not fine.<br></div><div><br></div>=
<div>And personally, I fail to see how `any(in_place<string>, 5, '=
;A')` is any harder to understand than your colon syntax. Remember: <a =
href=3D"https://en.cppreference.com/w/cpp/utility/in_place">`in_place` is a=
variable, not a type</a>. Thanks to variable concepts, we no longer need t=
he `{}` on tags.</div><div><br></div><div>You analogized your syntax with s=
tructured binding. And you're right; the right bit of syntactic sugar c=
an make some things significantly more useful. But structured binding remov=
ed <i>lots</i> of syntax at every use of the members. This is especially tr=
ue of `tuple`-like types; all of those `std::get<>` calls are huge an=
d bulky. Structured binding pays for itself in convenience.<br></div><div><=
br></div><div>Your syntax takes `{},` and replaces it with `:` (scoping iss=
ues aside). The removal of two characters cannot even <i>begin</i> to compe=
te with the improvement that structured binding provides. And that's ig=
noring the inconsistency it creates.</div><div><br></div><div>The scoping a=
spect of your proposal is interesting. Focus on that and ditch the part wit=
h the parameter that doesn't look like a parameter.<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/24ffbe29-a25e-493f-b026-ace438266adc%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/24ffbe29-a25e-493f-b026-ace438266adc=
%40isocpp.org</a>.<br />
------=_Part_75271_218380461.1531323538003--
------=_Part_75270_1990373281.1531323538003--
.
Author: mihailnajdenov@gmail.com
Date: Wed, 11 Jul 2018 12:09:54 -0700 (PDT)
Raw View
------=_Part_129275_1484430872.1531336194743
Content-Type: multipart/alternative;
boundary="----=_Part_129276_612907478.1531336194743"
------=_Part_129276_612907478.1531336194743
Content-Type: text/plain; charset="UTF-8"
On Wednesday, July 11, 2018 at 6:38:58 PM UTC+3, Nicol Bolas wrote:
>
> On Wednesday, July 11, 2018 at 4:51:01 AM UTC-4, mihailn...@gmail.com
> wrote:
>>
>> I think I know where the problem is - we don't need to express label
>> arguments in terms of a variable but in *terms of a type!*
>>
>> Look:
>>
>> rect(case topleft, Point p, Size sz); //< or whatever syntax
>>
>> usage:
>>
>> auto r = rect(topLeft: {}, {10, 10});
>>
>>
>> is transformed to
>>
>> class topLeft {};
>>
>> rect(topLeft, Point p , Size sz);
>>
>> usage is transformed to :
>>
>> auto r = rect(topLeft{}, {}, {10, 10});
>>
>>
>>
> I don't much like it, but I think it's moving in a useful direction.
>
> Let's start with the function declaration syntax. I don't really see the
> point of it.
>
> So you're injecting a class into the outer scope. So... why aren't you
> using `struct/class` as the keyword here? OK, yes, I know why; because that
> already has a different meaning (thanks to C): `class topLect` is
> equivalent to just `topLeft`, and changing that is problematic.
>
> The issue with injection is just that... you're not buying much. The code
> for these manifested types is ultimately trivial in size. So what's wrong
> with people just writing it out and making their code look like regular
> code?
>
> Another problem with it reminds me of the debates surrounding returning
> anonymous structures. The idea was only really useful when these structures
> were one-offs, where there was exactly one function that returned that
> struct. Well, it turns out that this is not the case a lot of times. While
> having `map::insert` return `pair`s is obviously impenetrable in terms of
> meaning, returning an anonymous struct isn't nearly as good as having it
> return a *named* structure. Why? Because every overload of `insert` on *every
> associative container* (ordered or not) needs to return the same struct
> that has the same meaning.
>
> So give it a *name* already.
>
> And that's one of the issues I have here. `std::in_place_t<T>` is used by
> several constructors across several objects. And because it isn't tied to
> those specific constructors in any way, any code that needs similar
> in-place construction functionality can employ it. The standard defines
> other tags that it reuses frequently, like `allocator_arg_t` and the like.
> Ones which non-standard library code can reuse to have the same meaning.
>
> So your feature would only ever really be useful in cases where you're
> dealing with a one-off tag. The problem is that one-offs sometimes... stop
> being one-offs.
>
> I don't contest that one-offs exist. My point is that they're sufficiently
> rare that we don't need grammar just to handle them. And by creating
> grammar just to handle them, you're encouraging the creation of one-offs
> for non-one-off problems.
>
> That's one of the advantages of the templated tag idea.
> `std::func_tag<"text">` will always resolve down to the same type. So
> multiple functions in different scopes and namespaces can share the same
> tag.
>
> ---
>
> Now, on to the next part: the usage syntax. This is where I think you've
> stumbled onto something.
>
> OK, so we have `topLeft:{}`. That looks like "create an object of a type".
> But what is that colon doing there? Why can't you just use `topLeft{}`?
>
> Scope.
>
> *Presumably* (because you never explained what it actually does, so I
> have to make assumptions), that colon performs some kind of reverse ADL.
> That is, when you find several candidate overloads, you deduce the full
> name of the type by matching the base names of the overloads with that one.
> Those which don't match are culled. The one that does match now defines the
> actual type.
>
> That way, if you're calling a function in a namespace or nested class, you
> don't have to do
> `Namespace::OtherNamespace::func(Namespace::OtherNamespace::topLeft{})`.
>
> And *that* is where we get to something that is potentially useful: the
> ability to take a base name of an entity and use the surrounding context to
> deduce the full pathname of that entity.
>
> This has wider implications than just your use case. This could allow
> `switch/case` operations over an `enum class` to no longer be required to
> repeat the enumeration name at each `case` label (obviously you can't use
> your `:` syntax if we want to allow that). And many other things can now be
> simplified.
>
> However, defining its behavior correctly is complicated, a complexity
> approaching list initialization. It impacts function overload resolution,
> which is a *titanic* can of worms. But if you can do it, and if you can
> find a syntax other than `:`, it could be significant. You'd solve not only
> this tag issue, but many other verbosity problems.
>
I have considerably changed the design an you hit many of the issues I
changed. I will post anew, probably a new topic
>
> As for the syntax - I don't care about the declaration, but having the
>> possibility to use : instead of comma for the label on the usage site is *game
>> changer *in terms of readability and expressiveness
>>
>> any(in_place<string>: 5, 'A');
>>
>> This is a *massive* improvement as it is now clear we are opening a
>> sub-scope in which we put the arguments
>>
>
> But that's a lie. There is no "sub-scope"; there is no concept of a
> "sub-scope" in C++. No book on C++ will explain how "sub-scopes" work
> because it does not exist.
>
> There is only a *convention* that creates the *illusion* of such a
> construct. The biggest trap new users fall into when learning anything is
> believing that they understand something when they actually *don't*. Your
> syntax encourages that; it makes them believe in a concept that doesn't
> actually exist.
>
> Conventions are fine. But conventions that make people believe in
> falsehoods are not fine.
>
> And personally, I fail to see how `any(in_place<string>, 5, 'A')` is any
> harder to understand than your colon syntax. Remember: `in_place` is a
> variable, not a type <https://en.cppreference.com/w/cpp/utility/in_place>.
> Thanks to variable concepts, we no longer need the `{}` on tags.
>
> You analogized your syntax with structured binding. And you're right; the
> right bit of syntactic sugar can make some things significantly more
> useful. But structured binding removed *lots* of syntax at every use of
> the members. This is especially true of `tuple`-like types; all of those
> `std::get<>` calls are huge and bulky. Structured binding pays for itself
> in convenience.
>
> Your syntax takes `{},` and replaces it with `:` (scoping issues aside).
> The removal of two characters cannot even *begin* to compete with the
> improvement that structured binding provides. And that's ignoring the
> inconsistency it creates.
>
Here we disagree.
For me the diff to any(in_place<string>: 5, 'A')is massive, it really is.
First and foremost,
you are fine here, *because* *you know the API*, on a alien api it will
give measurable boost in understanding!
And do you think a first time user will understand any(in_place<string>, 5,
'A')?
Not a chance - he will be baffled, but with colon it is clear that it is
some sort of clarification.
That is what I meant by implementation detail - to read the code it is
*better* *to* *ignore* the fact (or simply *not to know*) this is argument
passing.
It is better to read it as "thing: foo, bar", then "thing, foo, bar".
It is purely human language thing - the brain MUST stop reading a list and
start reading a clarification. The fact that under it is an arg is an impl
detail.
Same with structured bindings - the fact that these are NOT variables but
members is not important - they must be read as vars.
Second
The fact that it *semantically* is not an argument (it is a clarification)
opens the possibility to use names otherwise confusing or even wrong
rect(center, {12,12}); //< size is default
Horrible, It reads *we* *pass center va**riable and a size 12x12*
QString(number, 100)
Hum...
image(data, buffer, 12)
image(clone, background)
Hum, hum...
write(commit, package)
The point is - if we take away the sematic disambiguation ("a note" vs "a
list item") we inflict *massive* damage. Some interfaces become
*impossible,* not technically, but practically.
In that sense, *the colon alone* is enabling technology, much like
"separate variables" in structured bindings.
Separate variables give us "multiple return types", a colon gives us "named
constructors" (and more). Even if we take away the declaration part, even
if create tags by hand.
Yes we lie both times, but it is worth it. Nothing is stopping the user to
learn a label is an argument, (he will be able to pass it with ','), but,
he will appreciate the colon.
--
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/1efba96a-75fc-4f78-84fe-a1318dbccf6a%40isocpp.org.
------=_Part_129276_612907478.1531336194743
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Wednesday, July 11, 2018 at 6:38:58 PM UTC+3, N=
icol Bolas 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">On Wednesday, July 11, 2018 at 4:51:01 AM UTC-4, <a>mihailn...@gmail.co=
m</a> 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><=
/div><div>I think I know where the problem is - we don't need to expres=
s label arguments in terms of a variable but in <i>terms of a type!</i></di=
v><div><i></i><br></div><div>Look:</div><div><br></div><div><font face=3D"c=
ourier new,monospace">rect(case topleft, Point p, Size sz); //< or whate=
ver syntax</font></div><div><b></b><i></i><u></u><sub></sub><sup></sup><str=
ike></strike><br></div><div>usage:</div><div><br></div><div><font face=3D"c=
ourier new,monospace">auto r =3D rect(topLeft: {}, {10, 10});=C2=A0</font><=
/div><div><font face=3D"courier new,monospace"><br></font></div><div><font =
face=3D"arial,sans-serif"><br></font></div><div><font face=3D"arial,sans-se=
rif">is transformed to=C2=A0</font></div><div><font face=3D"arial,sans-seri=
f"><br></font></div><div><font face=3D"courier new,monospace">class topLeft=
{};</font></div><div><font face=3D"courier new,monospace"><br></font></div=
><div><font face=3D"arial,sans-serif"><span style=3D"display:inline!importa=
nt;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;text-align:left;text-decoration:none;=
text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">re=
ct(topLeft, Point p , Size sz);</span></font></div><div><font face=3D"arial=
,sans-serif"><b></b><i></i><u></u><sub></sub><sup></sup><strike></strike><b=
r></font></div><div><font face=3D"arial,sans-serif"><span style=3D"display:=
inline!important;float:none;background-color:transparent;color:rgb(34,34,34=
);font-family:"Arial","Helvetica",sans-serif;font-size:=
13px;font-style:normal;font-variant:normal;font-weight:400;letter-spacing:n=
ormal;text-align:left;text-decoration:none;text-indent:0px;text-transform:n=
one;white-space:normal;word-spacing:0px">usage <span style=3D"display:inlin=
e!important;float:none;background-color:transparent;color:rgb(34,34,34);fon=
t-family:arial,sans-serif;font-size:13px;font-style:normal;font-variant:nor=
mal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:n=
one;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px=
">is transformed to=C2=A0</span>:</span></font></div><div><font face=3D"ari=
al,sans-serif"><b></b><i></i><u></u><sub></sub><sup></sup><strike></strike>=
<br></font></div><div><font face=3D"arial,sans-serif"><span style=3D"displa=
y: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;text-align:left;text-=
decoration:none;text-indent:0px;text-transform:none;white-space:normal;word=
-spacing:0px">auto r =3D rect(topLeft{}, {}, {10, 10});</span></font></div>=
<div><font face=3D"arial,sans-serif"><b></b><i></i><u></u><sub></sub><sup><=
/sup><strike></strike><br></font></div><div><font face=3D"arial,sans-serif"=
><br></font></div></div></blockquote><div><br></div><div>I don't much l=
ike it, but I think it's moving in a useful direction.</div><div><br></=
div><div>Let's start with the function declaration syntax. I don't =
really see the point of it.</div><div><br></div><div>So you're injectin=
g a class into the outer scope. So... why aren't you using `struct/clas=
s` as the keyword here? OK, yes, I know why; because that already has a dif=
ferent meaning (thanks to C): `class topLect` is equivalent to just `topLef=
t`, and changing that is problematic.</div><div><br></div><div>The issue wi=
th injection is just that... you're not buying much. The code for these=
manifested types is ultimately trivial in size. So what's wrong with p=
eople just writing it out and making their code look like regular code?<br>=
</div><div></div><div><br></div><div>Another problem with it reminds me of =
the debates surrounding returning anonymous structures. The idea was only r=
eally useful when these structures were one-offs, where there was exactly o=
ne function that returned that struct. Well, it turns out that this is not =
the case a lot of times. While having `map::insert` return `pair`s is obvio=
usly impenetrable in terms of meaning, returning an anonymous struct isn=
9;t nearly as good as having it return a <i>named</i> structure. Why? Becau=
se every overload of `insert` on <i>every associative container</i> (ordere=
d or not) needs to return the same struct that has the same meaning.</div><=
div><br></div><div>So give it a <i>name</i> already.</div><div><br></div><d=
iv>And that's one of the issues I have here. `std::in_place_t<T>`=
is used by several constructors across several objects. And because it isn=
't tied to those specific constructors in any way, any code that needs =
similar in-place construction functionality can employ it. The standard def=
ines other tags that it reuses frequently, like `allocator_arg_t` and the l=
ike. Ones which non-standard library code can reuse to have the same meanin=
g.</div><div><br></div><div>So your feature would only ever really be usefu=
l in cases where you're dealing with a one-off tag. The problem is that=
one-offs sometimes... stop being one-offs.</div><div><br></div><div>I don&=
#39;t contest that one-offs exist. My point is that they're sufficientl=
y rare that we don't need grammar just to handle them. And by creating =
grammar just to handle them, you're encouraging the creation of one-off=
s for non-one-off problems.</div><div><br></div><div>That's one of the =
advantages of the templated tag idea. `std::func_tag<"text">=
;` will always resolve down to the same type. So multiple functions in diff=
erent scopes and namespaces can share the same tag.</div><div><br></div><di=
v>---</div><div><br></div><div>Now, on to the next part: the usage syntax. =
This is where I think you've stumbled onto something.</div><div><br></d=
iv><div>OK, so we have `topLeft:{}`. That looks like "create an object=
of a type". But what is that colon doing there? Why can't you jus=
t use `topLeft{}`?</div><div><br></div><div>Scope.</div><div><br></div><div=
><i>Presumably</i> (because you never explained what it actually does, so I=
have to make assumptions), that colon performs some kind of reverse ADL. T=
hat is, when you find several candidate overloads, you deduce the full name=
of the type by matching the base names of the overloads with that one. Tho=
se which don't match are culled. The one that does match now defines th=
e actual type.</div><div><br></div><div>That way, if you're calling a f=
unction in a namespace or nested class, you don't have to do `Namespace=
::OtherNamespace::<wbr>func(Namespace::<wbr>OtherNamespace::topLeft{})`.</d=
iv><div><br></div><div>And <i>that</i> is where we get to something that is=
potentially useful: the ability to take a base name of an entity and use t=
he surrounding context to deduce the full pathname of that entity.</div><di=
v><br></div><div>This has wider implications than just your use case. This =
could allow `switch/case` operations over an `enum class` to no longer be r=
equired to repeat the enumeration name at each `case` label (obviously you =
can't use your `:` syntax if we want to allow that). And many other thi=
ngs can now be simplified.</div><div><br></div><div>However, defining its b=
ehavior correctly is complicated, a complexity approaching list initializat=
ion. It impacts function overload resolution, which is a <i>titanic</i> can=
of worms. But if you can do it, and if you can find a syntax other than `:=
`, it could be significant. You'd solve not only this tag issue, but ma=
ny other verbosity problems.<br></div></div></blockquote><div><br></div><di=
v>I have considerably changed the design an you hit many of the issues I ch=
anged. I will post anew, probably a new topic</div><div>=C2=A0</div><blockq=
uote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-lef=
t: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div></div><div></di=
v><div><br></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><font face=3D"arial,sans-serif"></font></div><div><font face=3D"arial,s=
ans-serif"></font></div><div><font face=3D"arial,sans-serif">As for the syn=
tax - I don't care about the declaration, but having the possibility to=
use <font face=3D"courier new,monospace">:</font> instead of comma for the=
label on the usage site is <i>game changer </i>in terms of readability and=
expressiveness =C2=A0=C2=A0</font></div><div><font face=3D"arial,sans-seri=
f"><br></font></div><div><font face=3D"courier new,monospace">any(in_place&=
lt;string>: 5, 'A');</font></div><div><font face=3D"courier new,=
monospace"><br></font></div><div><font face=3D"arial,sans-serif">This is a =
<i>massive</i> improvement as it is now clear we are opening a sub-scope in=
which we put the arguments</font></div></div></blockquote><div><br></div><=
div>But that's a lie. There is no "sub-scope"; there is no co=
ncept of a "sub-scope" in C++. No book on C++ will explain how &q=
uot;sub-scopes" work because it does not exist.</div><div><br></div><d=
iv>There is only a <i>convention</i> that creates the <i>illusion</i> of su=
ch a construct. The biggest trap new users fall into when learning anything=
is believing that they understand something when they actually <i>don'=
t</i>. Your syntax encourages that; it makes them believe in a concept that=
doesn't actually exist.</div><div><br></div><div>Conventions are fine.=
But conventions that make people believe in falsehoods are not fine.<br></=
div><div><br></div><div>And personally, I fail to see how `any(in_place<=
string>, 5, 'A')` is any harder to understand than your colon sy=
ntax. Remember: <a onmousedown=3D"this.href=3D'https://www.google.com/u=
rl?q\x3dhttps%3A%2F%2Fen.cppreference.com%2Fw%2Fcpp%2Futility%2Fin_place\x2=
6sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFa8KY257P4YtdbmKCdfACsEC6TBQ';ret=
urn true;" onclick=3D"this.href=3D'https://www.google.com/url?q\x3dhttp=
s%3A%2F%2Fen.cppreference.com%2Fw%2Fcpp%2Futility%2Fin_place\x26sa\x3dD\x26=
sntz\x3d1\x26usg\x3dAFQjCNFa8KY257P4YtdbmKCdfACsEC6TBQ';return true;" h=
ref=3D"https://en.cppreference.com/w/cpp/utility/in_place" target=3D"_blank=
" rel=3D"nofollow">`in_place` is a variable, not a type</a>. Thanks to vari=
able concepts, we no longer need the `{}` on tags.</div><div><br></div><div=
>You analogized your syntax with structured binding. And you're right; =
the right bit of syntactic sugar can make some things significantly more us=
eful. But structured binding removed <i>lots</i> of syntax at every use of =
the members. This is especially true of `tuple`-like types; all of those `s=
td::get<>` calls are huge and bulky. Structured binding pays for itse=
lf in convenience.<br></div><div><br></div><div>Your syntax takes `{},` and=
replaces it with `:` (scoping issues aside). The removal of two characters=
cannot even <i>begin</i> to compete with the improvement that structured b=
inding provides. And that's ignoring the inconsistency it creates.</div=
></div></blockquote><div><br></div><div>Here we disagree.=C2=A0</div><div>F=
or me the diff to<span style=3D"text-align: left; color: rgb(34, 34, 34); t=
ext-transform: none; text-indent: 0px; letter-spacing: normal; font-size: 1=
3px; font-style: normal; font-variant: normal; font-weight: 400; text-decor=
ation: none; word-spacing: 0px; display: inline !important; white-space: no=
rmal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; background-c=
olor: transparent;"><font face=3D"courier new,monospace"> <span style=3D"te=
xt-align: left; color: rgb(34, 34, 34); text-transform: none; text-indent: =
0px; letter-spacing: normal; font-size: 13px; font-style: normal; font-vari=
ant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; di=
splay: inline !important; white-space: normal; orphans: 2; float: none; -we=
bkit-text-stroke-width: 0px; background-color: transparent;">any(in_place&l=
t;string>: 5, 'A')<font face=3D"arial,sans-serif">is massive, it=
really is.=C2=A0</font></span></font></span></div><div><span style=3D"text=
-align: left; color: rgb(34, 34, 34); text-transform: none; text-indent: 0p=
x; letter-spacing: normal; font-size: 13px; font-style: normal; font-varian=
t: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; disp=
lay: inline !important; white-space: normal; orphans: 2; float: none; -webk=
it-text-stroke-width: 0px; background-color: transparent;"><font face=3D"co=
urier new,monospace"><span style=3D"text-align: left; color: rgb(34, 34, 34=
); text-transform: none; text-indent: 0px; letter-spacing: normal; font-siz=
e: 13px; font-style: normal; font-variant: normal; font-weight: 400; text-d=
ecoration: none; word-spacing: 0px; display: inline !important; white-space=
: normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; backgrou=
nd-color: transparent;"><font face=3D"arial,sans-serif"><br></font></span><=
/font></span></div><div><font face=3D"arial,sans-serif">First and foremost,=
</font></div><div><font face=3D"arial,sans-serif">you are fine here, <i>bec=
ause</i> <i>you know the API</i>, on a alien api it will give measurable bo=
ost in understanding!</font></div><div><font face=3D"arial,sans-serif"><br>=
</font></div><div><font face=3D"arial,sans-serif">And do you think a first =
time user will understand </font><font face=3D"courier new,monospace">a</fo=
nt><span style=3D"text-align: left; color: rgb(34, 34, 34); text-transform:=
none; text-indent: 0px; letter-spacing: normal; font-size: 13px; font-styl=
e: normal; font-variant: normal; font-weight: 400; text-decoration: none; w=
ord-spacing: 0px; display: inline !important; white-space: normal; orphans:=
2; float: none; -webkit-text-stroke-width: 0px; background-color: transpar=
ent;"><font face=3D"courier new,monospace">ny(in_place<string>, 5, &#=
39;A')</font><font face=3D"arial,sans-serif">?</font></span><span style=
=3D"text-align: left; color: rgb(34, 34, 34); text-transform: none; text-in=
dent: 0px; letter-spacing: normal; font-size: 13px; font-style: normal; fon=
t-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0=
px; display: inline !important; white-space: normal; orphans: 2; float: non=
e; -webkit-text-stroke-width: 0px; background-color: transparent;"><br></sp=
an></div><div><font face=3D"courier new,monospace"><span style=3D"text-alig=
n: left; color: rgb(34, 34, 34); text-transform: none; text-indent: 0px; le=
tter-spacing: normal; font-size: 13px; font-style: normal; font-variant: no=
rmal; font-weight: 400; text-decoration: none; word-spacing: 0px; display: =
inline !important; white-space: normal; orphans: 2; float: none; -webkit-te=
xt-stroke-width: 0px; background-color: transparent;"><font face=3D"arial,s=
ans-serif">Not a chance - he will be baffled, but with colon it is clear th=
at it is some sort of clarification.</font></span></font></div><div><font f=
ace=3D"courier new,monospace"><span style=3D"text-align: left; color: rgb(3=
4, 34, 34); text-transform: none; text-indent: 0px; letter-spacing: normal;=
font-size: 13px; font-style: normal; font-variant: normal; font-weight: 40=
0; text-decoration: none; word-spacing: 0px; display: inline !important; wh=
ite-space: normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px;=
background-color: transparent;"><font face=3D"arial,sans-serif"><br></font=
></span></font></div><div><font face=3D"courier new,monospace"><span style=
=3D"text-align: left; color: rgb(34, 34, 34); text-transform: none; text-in=
dent: 0px; letter-spacing: normal; font-size: 13px; font-style: normal; fon=
t-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0=
px; display: inline !important; white-space: normal; orphans: 2; float: non=
e; -webkit-text-stroke-width: 0px; background-color: transparent;"><font fa=
ce=3D"arial,sans-serif">That is what I meant by implementation detail - to =
read the code it is <i>better</i> <i>to</i> <i>ignore</i> the fact (or simp=
ly <i>not to know</i>) this is argument passing.=C2=A0</font></span></font>=
</div><div><font face=3D"courier new,monospace"><span style=3D"text-align: =
left; color: rgb(34, 34, 34); text-transform: none; text-indent: 0px; lette=
r-spacing: normal; font-size: 13px; font-style: normal; font-variant: norma=
l; font-weight: 400; text-decoration: none; word-spacing: 0px; display: inl=
ine !important; white-space: normal; orphans: 2; float: none; -webkit-text-=
stroke-width: 0px; background-color: transparent;"><font face=3D"arial,sans=
-serif"><br></font></span></font></div><div><span style=3D"text-align: left=
; color: rgb(34, 34, 34); text-transform: none; text-indent: 0px; letter-sp=
acing: normal; font-size: 13px; font-style: normal; font-variant: normal; f=
ont-weight: 400; text-decoration: none; word-spacing: 0px; display: inline =
!important; white-space: normal; orphans: 2; float: none; -webkit-text-stro=
ke-width: 0px; background-color: transparent;"><font face=3D"courier new,mo=
nospace"><font face=3D"arial,sans-serif">It is </font></font>better <font f=
ace=3D"courier new,monospace"><font face=3D"arial,sans-serif">to read it as=
"<font face=3D"courier new,monospace">thing: foo, bar</font>", t=
hen <span style=3D"display: inline !important; float: none; background-colo=
r: transparent; color: rgb(34, 34, 34); font-family: arial,sans-serif; font=
-size: 13px; font-style: normal; font-variant: normal; font-weight: 400; le=
tter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; =
text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; whi=
te-space: normal; word-spacing: 0px;">"<font face=3D"courier new,monos=
pace">thing, foo, bar</font>"</span>.=C2=A0</font></font></span><font =
face=3D"courier new,monospace"><span style=3D"text-align: left; color: rgb(=
34, 34, 34); text-transform: none; text-indent: 0px; letter-spacing: normal=
; font-size: 13px; font-style: normal; font-variant: normal; font-weight: 4=
00; text-decoration: none; word-spacing: 0px; display: inline !important; w=
hite-space: normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px=
; background-color: transparent;"><font face=3D"arial,sans-serif"><br></fon=
t></span></font></div><div><font face=3D"courier new,monospace"><span style=
=3D"text-align: left; color: rgb(34, 34, 34); text-transform: none; text-in=
dent: 0px; letter-spacing: normal; font-size: 13px; font-style: normal; fon=
t-variant: normal; font-weight: 400; text-decoration: none; word-spacing: 0=
px; display: inline !important; white-space: normal; orphans: 2; float: non=
e; -webkit-text-stroke-width: 0px; background-color: transparent;"><font fa=
ce=3D"arial,sans-serif">It is purely human language thing - the brain MUST =
stop reading a list and start reading a clarification. The fact that under =
it is an arg is an impl detail.</font></span></font></div><div><font face=
=3D"courier new,monospace"><span style=3D"text-align: left; color: rgb(34, =
34, 34); text-transform: none; text-indent: 0px; letter-spacing: normal; fo=
nt-size: 13px; font-style: normal; font-variant: normal; font-weight: 400; =
text-decoration: none; word-spacing: 0px; display: inline !important; white=
-space: normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; ba=
ckground-color: transparent;"><font face=3D"arial,sans-serif"><br></font></=
span></font></div><div><font face=3D"courier new,monospace"><span style=3D"=
text-align: left; color: rgb(34, 34, 34); text-transform: none; text-indent=
: 0px; letter-spacing: normal; font-size: 13px; font-style: normal; font-va=
riant: normal; font-weight: 400; text-decoration: none; word-spacing: 0px; =
display: inline !important; white-space: normal; orphans: 2; float: none; -=
webkit-text-stroke-width: 0px; background-color: transparent;"><font face=
=3D"arial,sans-serif">Same with structured bindings - the fact that these a=
re NOT variables but members is not important - they must be read as vars.<=
/font></span></font></div><div><font face=3D"arial,sans-serif"><b></b><i></=
i><u></u><sub></sub><sup></sup><strike></strike><font face=3D"courier new,m=
onospace"></font><br></font></div><div><font face=3D"arial,sans-serif">Seco=
nd</font></div><div><font face=3D"arial,sans-serif"><br></font></div><div><=
font face=3D"arial,sans-serif">The fact that it <i>semantically</i> is not =
an argument (it is a clarification) opens the possibility to use names othe=
rwise confusing or even wrong</font></div><div><font face=3D"arial,sans-ser=
if"><br></font></div><div><font face=3D"courier new,monospace">rect(center,=
{12,12}); //< size is default</font></div><div><span style=3D"text-alig=
n: left; color: rgb(34, 34, 34); text-transform: none; text-indent: 0px; le=
tter-spacing: normal; font-size: 13px; font-style: normal; font-variant: no=
rmal; font-weight: 400; text-decoration: none; word-spacing: 0px; display: =
inline !important; white-space: normal; orphans: 2; float: none; -webkit-te=
xt-stroke-width: 0px; background-color: transparent;"><font face=3D"courier=
new,monospace"><span style=3D"text-align: left; color: rgb(34, 34, 34); te=
xt-transform: none; text-indent: 0px; letter-spacing: normal; font-size: 13=
px; font-style: normal; font-variant: normal; font-weight: 400; text-decora=
tion: none; word-spacing: 0px; display: inline !important; white-space: nor=
mal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; background-co=
lor: transparent;"><font face=3D"arial,sans-serif"><font face=3D"courier ne=
w,monospace"></font><br></font></span></font></span></div><div><font face=
=3D"arial,sans-serif">Horrible, It reads <i>we</i> <i>pass center va</i></f=
ont><i>riable and a size 12x12</i></div><div><font face=3D"courier new,mono=
space"></font><i></i><br></div><font face=3D"courier new,monospace">QString=
(number, 100)</font><div><font face=3D"courier new,monospace"></font><br></=
div><div><font face=3D"arial,sans-serif">Hum...</font></div><div><font face=
=3D"courier new,monospace"></font><br></div><div><font face=3D"courier new,=
monospace">image(data, buffer, 12)</font></div><div><font face=3D"courier n=
ew,monospace"><span style=3D"display: inline !important; float: none; backg=
round-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-dec=
oration: none; text-indent: 0px; text-transform: none; -webkit-text-stroke-=
width: 0px; white-space: normal; word-spacing: 0px;">image(clone, backgroun=
d)</span><b></b><i></i><u></u><sub></sub><sup></sup><strike></strike></font=
></div><div><font face=3D"courier new,monospace"><br></font></div><div><fon=
t face=3D"courier new,monospace"><span style=3D"display: inline !important;=
float: none; background-color: transparent; color: rgb(34, 34, 34); font-f=
amily: arial,sans-serif; 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; -webki=
t-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">Hum, hum=
....</span></font></div><div><font face=3D"courier new,monospace"><span styl=
e=3D"display: inline !important; float: none; background-color: transparent=
; color: rgb(34, 34, 34); font-family: arial,sans-serif; font-size: 13px; f=
ont-style: normal; font-variant: normal; font-weight: 400; letter-spacing: =
normal; orphans: 2; 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;"><br></span></font></div><div><span style=3D"text-al=
ign: left; color: rgb(34, 34, 34); text-transform: none; text-indent: 0px; =
letter-spacing: normal; font-size: 13px; font-style: normal; font-variant: =
normal; font-weight: 400; text-decoration: none; word-spacing: 0px; display=
: inline !important; white-space: normal; orphans: 2; float: none; -webkit-=
text-stroke-width: 0px; background-color: transparent;"><font face=3D"couri=
er new,monospace">write(commit, package)</font></span></div><div><font face=
=3D"courier new,monospace"><br></font></div><div><font face=3D"arial,sans-s=
erif">The point is - if we take away the sematic disambiguation ("a no=
te" vs "a list item") we inflict <i>massive</i> damage. Some=
interfaces become <i>impossible,</i> not technically, but practically.</fo=
nt></div><div><font face=3D"arial,sans-serif"><br></font></div><div><font f=
ace=3D"arial,sans-serif">In that sense, <i>the colon alone</i> is enabling =
technology, much like "separate variables" in structured bindings=
..</font></div><div><font face=3D"arial,sans-serif"><br></font></div><div><f=
ont face=3D"arial,sans-serif">Separate variables give us "multiple ret=
urn types", a colon gives us "named constructors" (and more)=
.. Even if we take away the declaration part, even if create tags by hand.</=
font></div><div><font face=3D"arial,sans-serif"><br></font></div><div><font=
face=3D"arial,sans-serif">Yes we lie both times, but it is worth it. Nothi=
ng is stopping the user to learn a label is an argument, (he will be able t=
o pass it with ','), but, he will appreciate the colon.</font></div=
><div><font face=3D"arial,sans-serif"><br></font></div><div><font face=3D"a=
rial,sans-serif"><br></font></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/1efba96a-75fc-4f78-84fe-a1318dbccf6a%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/1efba96a-75fc-4f78-84fe-a1318dbccf6a=
%40isocpp.org</a>.<br />
------=_Part_129276_612907478.1531336194743--
------=_Part_129275_1484430872.1531336194743--
.
Author: Nicol Bolas <jmckesson@gmail.com>
Date: Wed, 11 Jul 2018 16:33:51 -0700 (PDT)
Raw View
------=_Part_11719_1768709520.1531352031298
Content-Type: multipart/alternative;
boundary="----=_Part_11720_1134544177.1531352031299"
------=_Part_11720_1134544177.1531352031299
Content-Type: text/plain; charset="UTF-8"
On Wednesday, July 11, 2018 at 3:09:54 PM UTC-4, mihailn...@gmail.com wrote:
>
> On Wednesday, July 11, 2018 at 6:38:58 PM UTC+3, Nicol Bolas wrote:
>>
>> On Wednesday, July 11, 2018 at 4:51:01 AM UTC-4, mihailn...@gmail.com
>> wrote:
>>>
>>> I think I know where the problem is - we don't need to express label
>>> arguments in terms of a variable but in *terms of a type!*
>>>
>>> Look:
>>>
>>> rect(case topleft, Point p, Size sz); //< or whatever syntax
>>>
>>> usage:
>>>
>>> auto r = rect(topLeft: {}, {10, 10});
>>>
>>>
>>> is transformed to
>>>
>>> class topLeft {};
>>>
>>> rect(topLeft, Point p , Size sz);
>>>
>>> usage is transformed to :
>>>
>>> auto r = rect(topLeft{}, {}, {10, 10});
>>>
>>>
>>>
>> I don't much like it, but I think it's moving in a useful direction.
>>
>> Let's start with the function declaration syntax. I don't really see the
>> point of it.
>>
>> So you're injecting a class into the outer scope. So... why aren't you
>> using `struct/class` as the keyword here? OK, yes, I know why; because that
>> already has a different meaning (thanks to C): `class topLect` is
>> equivalent to just `topLeft`, and changing that is problematic.
>>
>> The issue with injection is just that... you're not buying much. The code
>> for these manifested types is ultimately trivial in size. So what's wrong
>> with people just writing it out and making their code look like regular
>> code?
>>
>> Another problem with it reminds me of the debates surrounding returning
>> anonymous structures. The idea was only really useful when these structures
>> were one-offs, where there was exactly one function that returned that
>> struct. Well, it turns out that this is not the case a lot of times. While
>> having `map::insert` return `pair`s is obviously impenetrable in terms of
>> meaning, returning an anonymous struct isn't nearly as good as having it
>> return a *named* structure. Why? Because every overload of `insert` on *every
>> associative container* (ordered or not) needs to return the same struct
>> that has the same meaning.
>>
>> So give it a *name* already.
>>
>> And that's one of the issues I have here. `std::in_place_t<T>` is used by
>> several constructors across several objects. And because it isn't tied to
>> those specific constructors in any way, any code that needs similar
>> in-place construction functionality can employ it. The standard defines
>> other tags that it reuses frequently, like `allocator_arg_t` and the like.
>> Ones which non-standard library code can reuse to have the same meaning.
>>
>> So your feature would only ever really be useful in cases where you're
>> dealing with a one-off tag. The problem is that one-offs sometimes... stop
>> being one-offs.
>>
>> I don't contest that one-offs exist. My point is that they're
>> sufficiently rare that we don't need grammar just to handle them. And by
>> creating grammar just to handle them, you're encouraging the creation of
>> one-offs for non-one-off problems.
>>
>> That's one of the advantages of the templated tag idea.
>> `std::func_tag<"text">` will always resolve down to the same type. So
>> multiple functions in different scopes and namespaces can share the same
>> tag.
>>
>> ---
>>
>> Now, on to the next part: the usage syntax. This is where I think you've
>> stumbled onto something.
>>
>> OK, so we have `topLeft:{}`. That looks like "create an object of a
>> type". But what is that colon doing there? Why can't you just use
>> `topLeft{}`?
>>
>> Scope.
>>
>> *Presumably* (because you never explained what it actually does, so I
>> have to make assumptions), that colon performs some kind of reverse ADL.
>> That is, when you find several candidate overloads, you deduce the full
>> name of the type by matching the base names of the overloads with that one.
>> Those which don't match are culled. The one that does match now defines the
>> actual type.
>>
>> That way, if you're calling a function in a namespace or nested class,
>> you don't have to do
>> `Namespace::OtherNamespace::func(Namespace::OtherNamespace::topLeft{})`.
>>
>> And *that* is where we get to something that is potentially useful: the
>> ability to take a base name of an entity and use the surrounding context to
>> deduce the full pathname of that entity.
>>
>> This has wider implications than just your use case. This could allow
>> `switch/case` operations over an `enum class` to no longer be required to
>> repeat the enumeration name at each `case` label (obviously you can't use
>> your `:` syntax if we want to allow that). And many other things can now be
>> simplified.
>>
>> However, defining its behavior correctly is complicated, a complexity
>> approaching list initialization. It impacts function overload resolution,
>> which is a *titanic* can of worms. But if you can do it, and if you can
>> find a syntax other than `:`, it could be significant. You'd solve not only
>> this tag issue, but many other verbosity problems.
>>
>
> I have considerably changed the design an you hit many of the issues I
> changed. I will post anew, probably a new topic
>
>
>>
>> As for the syntax - I don't care about the declaration, but having the
>>> possibility to use : instead of comma for the label on the usage site
>>> is *game changer *in terms of readability and expressiveness
>>>
>>> any(in_place<string>: 5, 'A');
>>>
>>> This is a *massive* improvement as it is now clear we are opening a
>>> sub-scope in which we put the arguments
>>>
>>
>> But that's a lie. There is no "sub-scope"; there is no concept of a
>> "sub-scope" in C++. No book on C++ will explain how "sub-scopes" work
>> because it does not exist.
>>
>> There is only a *convention* that creates the *illusion* of such a
>> construct. The biggest trap new users fall into when learning anything is
>> believing that they understand something when they actually *don't*.
>> Your syntax encourages that; it makes them believe in a concept that
>> doesn't actually exist.
>>
>> Conventions are fine. But conventions that make people believe in
>> falsehoods are not fine.
>>
>> And personally, I fail to see how `any(in_place<string>, 5, 'A')` is any
>> harder to understand than your colon syntax. Remember: `in_place` is a
>> variable, not a type <https://en.cppreference.com/w/cpp/utility/in_place>.
>> Thanks to variable concepts, we no longer need the `{}` on tags.
>>
>> You analogized your syntax with structured binding. And you're right; the
>> right bit of syntactic sugar can make some things significantly more
>> useful. But structured binding removed *lots* of syntax at every use of
>> the members. This is especially true of `tuple`-like types; all of those
>> `std::get<>` calls are huge and bulky. Structured binding pays for itself
>> in convenience.
>>
>> Your syntax takes `{},` and replaces it with `:` (scoping issues aside).
>> The removal of two characters cannot even *begin* to compete with the
>> improvement that structured binding provides. And that's ignoring the
>> inconsistency it creates.
>>
>
> Here we disagree.
> For me the diff to any(in_place<string>: 5, 'A')is massive, it really is.
>
> First and foremost,
> you are fine here, *because* *you know the API*, on a alien api it will
> give measurable boost in understanding!
>
> And do you think a first time user will understand any(in_place<string>,
> 5, 'A')?
> Not a chance - he will be baffled, but with colon it is clear that it is
> some sort of clarification.
>
First, it's not "some sort of clarification". It's a *variable*. Again,
don't lie to programmers.
Second, I think you consistently underestimate new users. Telling them that
there is a variable called `std::in_place<T>` is not something that's going
to confuse and frighten them. It's not something they have to learn via
route.
Third, I think you forget that, sooner or later, new users are going to
have to learn to read a series of constructor declarations and figure out
what's going on. Which means they'll need to read `std::variant`'s
constructors and work out how to call them.
If they've seen `in_place<T>` before, if they understand that it's a
variable and what it is used for, then they can understand how to employ it
when they see that `variant` has some constructors that take
`std::in_place_t<T>` as a type.
In your world of "notation", they don't know how to translate from a
function declaration into a set of arguments properly. They learned
`in_place<T>` by convention, not by understanding what it actually is. So
when they see a function that takes `std::in_place_t<T>`, they don't really
know what to do with that or how to get a value of that type.
That is what I meant by implementation detail - to read the code it is
> *better* *to* *ignore* the fact (or simply *not to know*) this is
> argument passing.
>
For whom is it better? For the person reading the code? For the person
writing it? For your hypothetical new user that doesn't understand that
global variables exist?
The fact that it is a value being used to control overload resolution is
important. It's what allows forwarding to work. And that's something new
users ought to be introduced to.
Your hypothetical new user that doesn't understand that global variables
exist will have a hard time understanding how
`vector<any>::emplace_back(in_place<string>: 5, 'a')` works, because they
don't recognize `in_place` as something being passed. They only recognize
it as a piece of syntax that `any` uses; how that syntax gets transmitted
is unclear to them.
Sure, they know that it works. But without knowing *why*, they cannot stop
being new users.
There's a common phrase that typifies this: lies to children. Telling new
people, not merely a simplified view of the world, but an easy-to-digest
view that is ultimately wrong. Some lies told to children are fine;
learning Newtonian mechanics is OK, because they're close enough to being
right that only certain fields of study run into cases where it isn't.
This is not like that.
It is better to read it as "thing: foo, bar", then "thing, foo, bar".
> It is purely human language thing - the brain MUST stop reading a list and
> start reading a clarification. The fact that under it is an arg is an impl
> detail.
>
> Same with structured bindings - the fact that these are NOT variables but
> members is not important - they must be read as vars.
>
Except of course when that fact suddenly becomes relevant, like when you
use `decltype` on them. Or when you want to *capture* them in a lambda
(which BTW, you can't do right now).
Also, it should be noted how many questions get asked about the oddities of
structured bindings' "variables".
Lies have costs. And while structured binding has costs, it has paid for
them twice over in usability. I do not see a mere colon doing the same.
Second
>
> The fact that it *semantically* is not an argument (it is a
> clarification) opens the possibility to use names otherwise confusing or
> even wrong
>
> rect(center, {12,12}); //< size is default
>
> Horrible, It reads *we* *pass center va**riable and a size 12x12*
>
But that's literally *what you're doing*. You're arguing for a syntax that
hides what you're doing.
QString(number, 100)
>
> Hum...
>
> image(data, buffer, 12)
> image(clone, background)
>
> Hum, hum...
>
I don't see how adding a colon improves any of these cases. Without
context, I have no idea what any of these functions or constructors or
whatever are doing.
write(commit, package)
>
> The point is - if we take away the sematic disambiguation ("a note" vs "a
> list item") we inflict *massive* damage. Some interfaces become
> *impossible,* not technically, but practically.
>
> In that sense, *the colon alone* is enabling technology, much like
> "separate variables" in structured bindings.
>
I fail to see that. `rect(center: {12, 12})`
> Separate variables give us "multiple return types", a colon gives us
> "named constructors" (and more).
>
The problem I have with this analogy is simply the relative cost of the two
constructs. `get<>` is huge, bulky, annoying, and has to be done every time
you access the member of an MRV function that returned a tuple.
A comma is none of that. Structured binding purchases its place in C++ by
taking huge, complex, and ugly syntax and making it big. Yours takes
`rect(center, {12, 12})` and turns it into `rect(center: {12, 12})`.
There's no comparison; structured binding solves a much bigger problem than
your syntax. Your syntax is purely a rotational improvement. And that's if
we accept the premise that it's an improvement.
--
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/9658f3b1-3cbf-4c8f-b259-95505df9a8c4%40isocpp.org.
------=_Part_11720_1134544177.1531352031299
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Wednesday, July 11, 2018 at 3:09:54 PM UTC-4, mihailn..=
..@gmail.com wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;marg=
in-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"=
ltr">On Wednesday, July 11, 2018 at 6:38:58 PM UTC+3, Nicol Bolas wrote:<bl=
ockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-l=
eft:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">On Wednesday, July 11=
, 2018 at 4:51:01 AM UTC-4, <a>mihailn...@gmail.com</a> wrote:<blockquote c=
lass=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #c=
cc solid;padding-left:1ex"><div dir=3D"ltr"><div></div><div>I think I know =
where the problem is - we don't need to express label arguments in term=
s of a variable but in <i>terms of a type!</i></div><div><i></i><br></div><=
div>Look:</div><div><br></div><div><font face=3D"courier new,monospace">rec=
t(case topleft, Point p, Size sz); //< or whatever syntax</font></div><d=
iv><b></b><i></i><u></u><sub></sub><sup></sup><strike></strike><br></div><d=
iv>usage:</div><div><br></div><div><font face=3D"courier new,monospace">aut=
o r =3D rect(topLeft: {}, {10, 10});=C2=A0</font></div><div><font face=3D"c=
ourier new,monospace"><br></font></div><div><font face=3D"arial,sans-serif"=
><br></font></div><div><font face=3D"arial,sans-serif">is transformed to=C2=
=A0</font></div><div><font face=3D"arial,sans-serif"><br></font></div><div>=
<font face=3D"courier new,monospace">class topLeft {};</font></div><div><fo=
nt face=3D"courier new,monospace"><br></font></div><div><font face=3D"arial=
,sans-serif"><span style=3D"display:inline!important;float:none;background-=
color:transparent;color:rgb(34,34,34);font-family:courier new,monospace;fon=
t-size:13px;font-style:normal;font-variant:normal;font-weight:400;letter-sp=
acing:normal;text-align:left;text-decoration:none;text-indent:0px;text-tran=
sform:none;white-space:normal;word-spacing:0px">rect(topLeft, Point p , Siz=
e sz);</span></font></div><div><font face=3D"arial,sans-serif"><b></b><i></=
i><u></u><sub></sub><sup></sup><strike></strike><br></font></div><div><font=
face=3D"arial,sans-serif"><span style=3D"display:inline!important;float:no=
ne;background-color:transparent;color:rgb(34,34,34);font-family:"Arial=
","Helvetica",sans-serif;font-size:13px;font-style:normal;fo=
nt-variant:normal;font-weight:400;letter-spacing:normal;text-align:left;tex=
t-decoration:none;text-indent:0px;text-transform:none;white-space:normal;wo=
rd-spacing:0px">usage <span style=3D"display:inline!important;float:none;ba=
ckground-color:transparent;color:rgb(34,34,34);font-family:arial,sans-serif=
;font-size:13px;font-style:normal;font-variant:normal;font-weight:400;lette=
r-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-=
transform:none;white-space:normal;word-spacing:0px">is transformed to=C2=A0=
</span>:</span></font></div><div><font face=3D"arial,sans-serif"><b></b><i>=
</i><u></u><sub></sub><sup></sup><strike></strike><br></font></div><div><fo=
nt face=3D"arial,sans-serif"><span style=3D"display:inline!important;float:=
none;background-color:transparent;color:rgb(34,34,34);font-family:courier n=
ew,monospace;font-size:13px;font-style:normal;font-variant:normal;font-weig=
ht:400;letter-spacing:normal;text-align:left;text-decoration:none;text-inde=
nt:0px;text-transform:none;white-space:normal;word-spacing:0px">auto r =3D =
rect(topLeft{}, {}, {10, 10});</span></font></div><div><font face=3D"arial,=
sans-serif"><b></b><i></i><u></u><sub></sub><sup></sup><strike></strike><br=
></font></div><div><font face=3D"arial,sans-serif"><br></font></div></div><=
/blockquote><div><br></div><div>I don't much like it, but I think it=
9;s moving in a useful direction.</div><div><br></div><div>Let's start =
with the function declaration syntax. I don't really see the point of i=
t.</div><div><br></div><div>So you're injecting a class into the outer =
scope. So... why aren't you using `struct/class` as the keyword here? O=
K, yes, I know why; because that already has a different meaning (thanks to=
C): `class topLect` is equivalent to just `topLeft`, and changing that is =
problematic.</div><div><br></div><div>The issue with injection is just that=
.... you're not buying much. The code for these manifested types is ulti=
mately trivial in size. So what's wrong with people just writing it out=
and making their code look like regular code?<br></div><div></div><div><br=
></div><div>Another problem with it reminds me of the debates surrounding r=
eturning anonymous structures. The idea was only really useful when these s=
tructures were one-offs, where there was exactly one function that returned=
that struct. Well, it turns out that this is not the case a lot of times. =
While having `map::insert` return `pair`s is obviously impenetrable in term=
s of meaning, returning an anonymous struct isn't nearly as good as hav=
ing it return a <i>named</i> structure. Why? Because every overload of `ins=
ert` on <i>every associative container</i> (ordered or not) needs to return=
the same struct that has the same meaning.</div><div><br></div><div>So giv=
e it a <i>name</i> already.</div><div><br></div><div>And that's one of =
the issues I have here. `std::in_place_t<T>` is used by several const=
ructors across several objects. And because it isn't tied to those spec=
ific constructors in any way, any code that needs similar in-place construc=
tion functionality can employ it. The standard defines other tags that it r=
euses frequently, like `allocator_arg_t` and the like. Ones which non-stand=
ard library code can reuse to have the same meaning.</div><div><br></div><d=
iv>So your feature would only ever really be useful in cases where you'=
re dealing with a one-off tag. The problem is that one-offs sometimes... st=
op being one-offs.</div><div><br></div><div>I don't contest that one-of=
fs exist. My point is that they're sufficiently rare that we don't =
need grammar just to handle them. And by creating grammar just to handle th=
em, you're encouraging the creation of one-offs for non-one-off problem=
s.</div><div><br></div><div>That's one of the advantages of the templat=
ed tag idea. `std::func_tag<"text">` will always resolve do=
wn to the same type. So multiple functions in different scopes and namespac=
es can share the same tag.</div><div><br></div><div>---</div><div><br></div=
><div>Now, on to the next part: the usage syntax. This is where I think you=
've stumbled onto something.</div><div><br></div><div>OK, so we have `t=
opLeft:{}`. That looks like "create an object of a type". But wha=
t is that colon doing there? Why can't you just use `topLeft{}`?</div><=
div><br></div><div>Scope.</div><div><br></div><div><i>Presumably</i> (becau=
se you never explained what it actually does, so I have to make assumptions=
), that colon performs some kind of reverse ADL. That is, when you find sev=
eral candidate overloads, you deduce the full name of the type by matching =
the base names of the overloads with that one. Those which don't match =
are culled. The one that does match now defines the actual type.</div><div>=
<br></div><div>That way, if you're calling a function in a namespace or=
nested class, you don't have to do `Namespace::OtherNamespace::<wbr>fu=
nc(Namespace::<wbr>OtherNamespace::topLeft{})`.</div><div><br></div><div>An=
d <i>that</i> is where we get to something that is potentially useful: the =
ability to take a base name of an entity and use the surrounding context to=
deduce the full pathname of that entity.</div><div><br></div><div>This has=
wider implications than just your use case. This could allow `switch/case`=
operations over an `enum class` to no longer be required to repeat the enu=
meration name at each `case` label (obviously you can't use your `:` sy=
ntax if we want to allow that). And many other things can now be simplified=
..</div><div><br></div><div>However, defining its behavior correctly is comp=
licated, a complexity approaching list initialization. It impacts function =
overload resolution, which is a <i>titanic</i> can of worms. But if you can=
do it, and if you can find a syntax other than `:`, it could be significan=
t. You'd solve not only this tag issue, but many other verbosity proble=
ms.<br></div></div></blockquote><div><br></div><div>I have considerably cha=
nged the design an you hit many of the issues I changed. I will post anew, =
probably a new topic</div><div>=C2=A0</div><blockquote class=3D"gmail_quote=
" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-le=
ft:1ex"><div dir=3D"ltr"><div></div><div></div><div><br></div><blockquote c=
lass=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #c=
cc solid;padding-left:1ex"><div dir=3D"ltr"><div><font face=3D"arial,sans-s=
erif"></font></div><div><font face=3D"arial,sans-serif"></font></div><div><=
font face=3D"arial,sans-serif">As for the syntax - I don't care about t=
he declaration, but having the possibility to use <font face=3D"courier new=
,monospace">:</font> instead of comma for the label on the usage site is <i=
>game changer </i>in terms of readability and expressiveness =C2=A0=C2=A0</=
font></div><div><font face=3D"arial,sans-serif"><br></font></div><div><font=
face=3D"courier new,monospace">any(in_place<string>: 5, 'A')=
;</font></div><div><font face=3D"courier new,monospace"><br></font></div><d=
iv><font face=3D"arial,sans-serif">This is a <i>massive</i> improvement as =
it is now clear we are opening a sub-scope in which we put the arguments</f=
ont></div></div></blockquote><div><br></div><div>But that's a lie. Ther=
e is no "sub-scope"; there is no concept of a "sub-scope&quo=
t; in C++. No book on C++ will explain how "sub-scopes" work beca=
use it does not exist.</div><div><br></div><div>There is only a <i>conventi=
on</i> that creates the <i>illusion</i> of such a construct. The biggest tr=
ap new users fall into when learning anything is believing that they unders=
tand something when they actually <i>don't</i>. Your syntax encourages =
that; it makes them believe in a concept that doesn't actually exist.</=
div><div><br></div><div>Conventions are fine. But conventions that make peo=
ple believe in falsehoods are not fine.<br></div><div><br></div><div>And pe=
rsonally, I fail to see how `any(in_place<string>, 5, 'A')` i=
s any harder to understand than your colon syntax. Remember: <a href=3D"htt=
ps://en.cppreference.com/w/cpp/utility/in_place" rel=3D"nofollow" target=3D=
"_blank" onmousedown=3D"this.href=3D'https://www.google.com/url?q\x3dht=
tps%3A%2F%2Fen.cppreference.com%2Fw%2Fcpp%2Futility%2Fin_place\x26sa\x3dD\x=
26sntz\x3d1\x26usg\x3dAFQjCNFa8KY257P4YtdbmKCdfACsEC6TBQ';return true;"=
onclick=3D"this.href=3D'https://www.google.com/url?q\x3dhttps%3A%2F%2F=
en.cppreference.com%2Fw%2Fcpp%2Futility%2Fin_place\x26sa\x3dD\x26sntz\x3d1\=
x26usg\x3dAFQjCNFa8KY257P4YtdbmKCdfACsEC6TBQ';return true;">`in_place` =
is a variable, not a type</a>. Thanks to variable concepts, we no longer ne=
ed the `{}` on tags.</div><div><br></div><div>You analogized your syntax wi=
th structured binding. And you're right; the right bit of syntactic sug=
ar can make some things significantly more useful. But structured binding r=
emoved <i>lots</i> of syntax at every use of the members. This is especiall=
y true of `tuple`-like types; all of those `std::get<>` calls are hug=
e and bulky. Structured binding pays for itself in convenience.<br></div><d=
iv><br></div><div>Your syntax takes `{},` and replaces it with `:` (scoping=
issues aside). The removal of two characters cannot even <i>begin</i> to c=
ompete with the improvement that structured binding provides. And that'=
s ignoring the inconsistency it creates.</div></div></blockquote><div><br><=
/div><div>Here we disagree.=C2=A0</div><div>For me the diff to<span style=
=3D"text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0px=
;letter-spacing:normal;font-size:13px;font-style:normal;font-variant:normal=
;font-weight:400;text-decoration:none;word-spacing:0px;display:inline!impor=
tant;white-space:normal;float:none;background-color:transparent"><font face=
=3D"courier new,monospace"> <span style=3D"text-align:left;color:rgb(34,34,=
34);text-transform:none;text-indent:0px;letter-spacing:normal;font-size:13p=
x;font-style:normal;font-variant:normal;font-weight:400;text-decoration:non=
e;word-spacing:0px;display:inline!important;white-space:normal;float:none;b=
ackground-color:transparent">any(in_place<string>: 5, 'A')<fo=
nt face=3D"arial,sans-serif">is massive, it really is.=C2=A0</font></span><=
/font></span></div><div><span style=3D"text-align:left;color:rgb(34,34,34);=
text-transform:none;text-indent:0px;letter-spacing:normal;font-size:13px;fo=
nt-style:normal;font-variant:normal;font-weight:400;text-decoration:none;wo=
rd-spacing:0px;display:inline!important;white-space:normal;float:none;backg=
round-color:transparent"><font face=3D"courier new,monospace"><span style=
=3D"text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0px=
;letter-spacing:normal;font-size:13px;font-style:normal;font-variant:normal=
;font-weight:400;text-decoration:none;word-spacing:0px;display:inline!impor=
tant;white-space:normal;float:none;background-color:transparent"><font face=
=3D"arial,sans-serif"><br></font></span></font></span></div><div><font face=
=3D"arial,sans-serif">First and foremost,</font></div><div><font face=3D"ar=
ial,sans-serif">you are fine here, <i>because</i> <i>you know the API</i>, =
on a alien api it will give measurable boost in understanding!</font></div>=
<div><font face=3D"arial,sans-serif"><br></font></div><div><font face=3D"ar=
ial,sans-serif">And do you think a first time user will understand </font><=
font face=3D"courier new,monospace">a</font><span style=3D"text-align:left;=
color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:norm=
al;font-size:13px;font-style:normal;font-variant:normal;font-weight:400;tex=
t-decoration:none;word-spacing:0px;display:inline!important;white-space:nor=
mal;float:none;background-color:transparent"><font face=3D"courier new,mono=
space">ny(in_place<string>, 5, 'A')</font><font face=3D"arial=
,sans-serif">?</font></span><span style=3D"text-align:left;color:rgb(34,34,=
34);text-transform:none;text-indent:0px;letter-spacing:normal;font-size:13p=
x;font-style:normal;font-variant:normal;font-weight:400;text-decoration:non=
e;word-spacing:0px;display:inline!important;white-space:normal;float:none;b=
ackground-color:transparent"><br></span></div><div><font face=3D"courier ne=
w,monospace"><span style=3D"text-align:left;color:rgb(34,34,34);text-transf=
orm:none;text-indent:0px;letter-spacing:normal;font-size:13px;font-style:no=
rmal;font-variant:normal;font-weight:400;text-decoration:none;word-spacing:=
0px;display:inline!important;white-space:normal;float:none;background-color=
:transparent"><font face=3D"arial,sans-serif">Not a chance - he will be baf=
fled, but with colon it is clear that it is some sort of clarification.</fo=
nt></span></font></div></div></blockquote><div><br></div><div>First, it'=
;s not "some sort of clarification". It's a <i>variable</i>. =
Again, don't lie to programmers.</div><div><br></div><div>Second, I thi=
nk you consistently underestimate new users. Telling them that there is a v=
ariable called `std::in_place<T>` is not something that's going t=
o confuse and frighten them. It's not something they have to learn via =
route.</div><div><br></div><div>Third, I think you forget that, sooner or l=
ater, new users are going to have to learn to read a series of constructor =
declarations and figure out what's going on. Which means they'll ne=
ed to read `std::variant`'s constructors and work out how to call them.=
</div><div><br></div><div>If they've seen `in_place<T>` before, i=
f they understand that it's a variable and what it is used for, then th=
ey can understand how to employ it when they see that `variant` has some co=
nstructors that take `std::in_place_t<T>` as a type.</div><div><br></=
div><div>In your world of "notation", they don't know how to =
translate from a function declaration into a set of arguments properly. The=
y learned `in_place<T>` by convention, not by understanding what it a=
ctually is. So when they see a function that takes `std::in_place_t<T>=
;`, they don't really know what to do with that or how to get a value o=
f that type.<br></div><div><br></div><blockquote class=3D"gmail_quote" styl=
e=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left:=
1ex;"><div dir=3D"ltr"><div><font face=3D"courier new,monospace"><span sty=
le=3D"text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0=
px;letter-spacing:normal;font-size:13px;font-style:normal;font-variant:norm=
al;font-weight:400;text-decoration:none;word-spacing:0px;display:inline!imp=
ortant;white-space:normal;float:none;background-color:transparent"><font fa=
ce=3D"arial,sans-serif"></font></span></font></div><div><font face=3D"couri=
er new,monospace"><span style=3D"text-align:left;color:rgb(34,34,34);text-t=
ransform:none;text-indent:0px;letter-spacing:normal;font-size:13px;font-sty=
le:normal;font-variant:normal;font-weight:400;text-decoration:none;word-spa=
cing:0px;display:inline!important;white-space:normal;float:none;background-=
color:transparent"><font face=3D"arial,sans-serif">That is what I meant by =
implementation detail - to read the code it is <i>better</i> <i>to</i> <i>i=
gnore</i> the fact (or simply <i>not to know</i>) this is argument passing.=
</font></span></font></div></div></blockquote><div><br></div><div>For whom =
is it better? For the person reading the code? For the person writing it? F=
or your hypothetical new user that doesn't understand that global varia=
bles exist?</div><div><br></div><div>The fact that it is a value being used=
to control overload resolution is important. It's what allows forwardi=
ng to work. And that's something new users ought to be introduced to.</=
div><div><br></div><div>Your hypothetical new user that doesn't underst=
and that global variables exist will have a hard time understanding how `ve=
ctor<any>::emplace_back(in_place<string>: 5, 'a')` work=
s, because they don't recognize `in_place` as something being passed. T=
hey only recognize it as a piece of syntax that `any` uses; how that syntax=
gets transmitted is unclear to them.</div><div><br></div><div>Sure, they k=
now that it works. But without knowing <i>why</i>, they cannot stop being n=
ew users.<br></div><div><br></div><div>There's a common phrase that typ=
ifies this: lies to children. Telling new people, not merely a simplified v=
iew of the world, but an easy-to-digest view that is ultimately wrong. Some=
lies told to children are fine; learning Newtonian mechanics is OK, becaus=
e they're close enough to being right that only certain fields of study=
run into cases where it isn't.</div><div><br></div><div>This is not li=
ke that.<br></div><div><br></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><font face=3D"courier new,monospace"><span style=
=3D"text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0px=
;letter-spacing:normal;font-size:13px;font-style:normal;font-variant:normal=
;font-weight:400;text-decoration:none;word-spacing:0px;display:inline!impor=
tant;white-space:normal;float:none;background-color:transparent"><font face=
=3D"arial,sans-serif"></font></span></font></div><div><span style=3D"text-a=
lign:left;color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-sp=
acing:normal;font-size:13px;font-style:normal;font-variant:normal;font-weig=
ht:400;text-decoration:none;word-spacing:0px;display:inline!important;white=
-space:normal;float:none;background-color:transparent"><font face=3D"courie=
r new,monospace"><font face=3D"arial,sans-serif">It is </font></font>better=
<font face=3D"courier new,monospace"><font face=3D"arial,sans-serif">to re=
ad it as "<font face=3D"courier new,monospace">thing: foo, bar</font>&=
quot;, then <span style=3D"display:inline!important;float:none;background-c=
olor:transparent;color:rgb(34,34,34);font-family:arial,sans-serif;font-size=
:13px;font-style:normal;font-variant:normal;font-weight:400;letter-spacing:=
normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:=
none;white-space:normal;word-spacing:0px">"<font face=3D"courier new,m=
onospace">thing, foo, bar</font>"</span>.=C2=A0</font></font></span><f=
ont face=3D"courier new,monospace"><span style=3D"text-align:left;color:rgb=
(34,34,34);text-transform:none;text-indent:0px;letter-spacing:normal;font-s=
ize:13px;font-style:normal;font-variant:normal;font-weight:400;text-decorat=
ion:none;word-spacing:0px;display:inline!important;white-space:normal;float=
:none;background-color:transparent"><font face=3D"arial,sans-serif"><br></f=
ont></span></font></div><div><font face=3D"courier new,monospace"><span sty=
le=3D"text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0=
px;letter-spacing:normal;font-size:13px;font-style:normal;font-variant:norm=
al;font-weight:400;text-decoration:none;word-spacing:0px;display:inline!imp=
ortant;white-space:normal;float:none;background-color:transparent"><font fa=
ce=3D"arial,sans-serif">It is purely human language thing - the brain MUST =
stop reading a list and start reading a clarification. The fact that under =
it is an arg is an impl detail.</font></span></font></div><div><font face=
=3D"courier new,monospace"><span style=3D"text-align:left;color:rgb(34,34,3=
4);text-transform:none;text-indent:0px;letter-spacing:normal;font-size:13px=
;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none=
;word-spacing:0px;display:inline!important;white-space:normal;float:none;ba=
ckground-color:transparent"><font face=3D"arial,sans-serif"><br></font></sp=
an></font></div><div><font face=3D"courier new,monospace"><span style=3D"te=
xt-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0px;lette=
r-spacing:normal;font-size:13px;font-style:normal;font-variant:normal;font-=
weight:400;text-decoration:none;word-spacing:0px;display:inline!important;w=
hite-space:normal;float:none;background-color:transparent"><font face=3D"ar=
ial,sans-serif">Same with structured bindings - the fact that these are NOT=
variables but members is not important - they must be read as vars.</font>=
</span></font></div></div></blockquote><div><br></div><div>Except of course=
when that fact suddenly becomes relevant, like when you use `decltype` on =
them. Or when you want to <i>capture</i> them in a lambda (which BTW, you c=
an't do right now).<br></div><div><br></div><div>Also, it should be not=
ed how many questions get asked about the oddities of structured bindings&#=
39; "variables".</div><div><br></div><div>Lies have costs. And wh=
ile structured binding has costs, it has paid for them twice over in usabil=
ity. I do not see a mere colon doing the same.<br></div><div><br></div><blo=
ckquote 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><font face=
=3D"arial,sans-serif"><b></b><i></i><u></u><sub></sub><sup></sup><strike></=
strike><font face=3D"courier new,monospace"></font></font></div><div><font =
face=3D"arial,sans-serif">Second</font></div><div><font face=3D"arial,sans-=
serif"><br></font></div><div><font face=3D"arial,sans-serif">The fact that =
it <i>semantically</i> is not an argument (it is a clarification) opens the=
possibility to use names otherwise confusing or even wrong</font></div><di=
v><font face=3D"arial,sans-serif"><br></font></div><div><font face=3D"couri=
er new,monospace">rect(center, {12,12}); //< size is default</font></div=
><div><span style=3D"text-align:left;color:rgb(34,34,34);text-transform:non=
e;text-indent:0px;letter-spacing:normal;font-size:13px;font-style:normal;fo=
nt-variant:normal;font-weight:400;text-decoration:none;word-spacing:0px;dis=
play:inline!important;white-space:normal;float:none;background-color:transp=
arent"><font face=3D"courier new,monospace"><span style=3D"text-align:left;=
color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spacing:norm=
al;font-size:13px;font-style:normal;font-variant:normal;font-weight:400;tex=
t-decoration:none;word-spacing:0px;display:inline!important;white-space:nor=
mal;float:none;background-color:transparent"><font face=3D"arial,sans-serif=
"><font face=3D"courier new,monospace"></font><br></font></span></font></sp=
an></div><div><font face=3D"arial,sans-serif">Horrible, It reads <i>we</i> =
<i>pass center va</i></font><i>riable and a size 12x12</i></div></div></blo=
ckquote><div><br></div><div>But that's literally <i>what you're doi=
ng</i>. You're arguing for a syntax that hides what you're doing.<b=
r></div><div><br></div><blockquote class=3D"gmail_quote" style=3D"margin: 0=
;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div di=
r=3D"ltr"><div></div><font face=3D"courier new,monospace">QString(number, 1=
00)</font><div><font face=3D"courier new,monospace"></font><br></div><div><=
font face=3D"arial,sans-serif">Hum...</font></div><div><font face=3D"courie=
r new,monospace"></font><br></div><div><font face=3D"courier new,monospace"=
>image(data, buffer, 12)</font></div><div><font face=3D"courier new,monospa=
ce"><span style=3D"display:inline!important;float:none;background-color:tra=
nsparent;color:rgb(34,34,34);font-family:courier new,monospace;font-size:13=
px;font-style:normal;font-variant:normal;font-weight:400;letter-spacing:nor=
mal;text-align:left;text-decoration:none;text-indent:0px;text-transform:non=
e;white-space:normal;word-spacing:0px">image(clone, background)</span><b></=
b><i></i><u></u><sub></sub><sup></sup><strike></strike></font></div><div><f=
ont face=3D"courier new,monospace"><br></font></div><div><font face=3D"cour=
ier new,monospace"><span style=3D"display:inline!important;float:none;backg=
round-color:transparent;color:rgb(34,34,34);font-family:arial,sans-serif;fo=
nt-size:13px;font-style:normal;font-variant:normal;font-weight:400;letter-s=
pacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-tra=
nsform:none;white-space:normal;word-spacing:0px">Hum, hum...</span></font><=
/div></div></blockquote><div><br></div><div>I don't see how adding a co=
lon improves any of these cases. Without context, I have no idea what any o=
f these functions or constructors or whatever are doing.<br></div><div><br>=
</div><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8=
ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div><f=
ont face=3D"courier new,monospace"><span style=3D"display:inline!important;=
float:none;background-color:transparent;color:rgb(34,34,34);font-family:ari=
al,sans-serif;font-size:13px;font-style:normal;font-variant:normal;font-wei=
ght:400;letter-spacing:normal;text-align:left;text-decoration:none;text-ind=
ent:0px;text-transform:none;white-space:normal;word-spacing:0px"></span></f=
ont></div><div><span style=3D"text-align:left;color:rgb(34,34,34);text-tran=
sform:none;text-indent:0px;letter-spacing:normal;font-size:13px;font-style:=
normal;font-variant:normal;font-weight:400;text-decoration:none;word-spacin=
g:0px;display:inline!important;white-space:normal;float:none;background-col=
or:transparent"><font face=3D"courier new,monospace">write(commit, package)=
</font></span></div><div><font face=3D"courier new,monospace"><br></font></=
div><div><font face=3D"arial,sans-serif">The point is - if we take away the=
sematic disambiguation ("a note" vs "a list item") we =
inflict <i>massive</i> damage. Some interfaces become <i>impossible,</i> no=
t technically, but practically.</font></div><div><font face=3D"arial,sans-s=
erif"><br></font></div><div><font face=3D"arial,sans-serif">In that sense, =
<i>the colon alone</i> is enabling technology, much like "separate var=
iables" in structured bindings.</font></div></div></blockquote><div><b=
r></div><div>I fail to see that. `rect(center: {12, 12})` <br></div><div>=
=C2=A0</div><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-lef=
t: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><=
div><font face=3D"arial,sans-serif"></font></div><div><font face=3D"arial,s=
ans-serif">Separate variables give us "multiple return types", a =
colon gives us "named constructors" (and more).</font></div></div=
></blockquote><div><br></div><div>The problem I have with this analogy is s=
imply the relative cost of the two constructs. `get<>` is huge, bulky=
, annoying, and has to be done every time you access the member of an MRV f=
unction that returned a tuple.</div><div><br></div><div>A comma is none of =
that. Structured binding purchases its place in C++ by taking huge, complex=
, and ugly syntax and making it big. Yours takes `rect(center, {12, 12})` a=
nd turns it into `rect(center: {12, 12})`.</div><div><br></div><div>There&#=
39;s no comparison; structured binding solves a much bigger problem than yo=
ur syntax. Your syntax is purely a rotational improvement. And that's i=
f we accept the premise that it's an improvement.<br></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/9658f3b1-3cbf-4c8f-b259-95505df9a8c4%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/9658f3b1-3cbf-4c8f-b259-95505df9a8c4=
%40isocpp.org</a>.<br />
------=_Part_11720_1134544177.1531352031299--
------=_Part_11719_1768709520.1531352031298--
.
Author: mihailnajdenov@gmail.com
Date: Thu, 12 Jul 2018 00:43:34 -0700 (PDT)
Raw View
------=_Part_64026_1778655015.1531381414471
Content-Type: multipart/alternative;
boundary="----=_Part_64027_1761069942.1531381414473"
------=_Part_64027_1761069942.1531381414473
Content-Type: text/plain; charset="UTF-8"
On Thursday, July 12, 2018 at 2:33:51 AM UTC+3, Nicol Bolas wrote:
>
> On Wednesday, July 11, 2018 at 3:09:54 PM UTC-4, mihailn...@gmail.com
> wrote:
>>
>> On Wednesday, July 11, 2018 at 6:38:58 PM UTC+3, Nicol Bolas wrote:
>>>
>>> On Wednesday, July 11, 2018 at 4:51:01 AM UTC-4, mihailn...@gmail.com
>>> wrote:
>>>>
>>>> I think I know where the problem is - we don't need to express label
>>>> arguments in terms of a variable but in *terms of a type!*
>>>>
>>>> Look:
>>>>
>>>> rect(case topleft, Point p, Size sz); //< or whatever syntax
>>>>
>>>> usage:
>>>>
>>>> auto r = rect(topLeft: {}, {10, 10});
>>>>
>>>>
>>>> is transformed to
>>>>
>>>> class topLeft {};
>>>>
>>>> rect(topLeft, Point p , Size sz);
>>>>
>>>> usage is transformed to :
>>>>
>>>> auto r = rect(topLeft{}, {}, {10, 10});
>>>>
>>>>
>>>>
>>> I don't much like it, but I think it's moving in a useful direction.
>>>
>>> Let's start with the function declaration syntax. I don't really see the
>>> point of it.
>>>
>>> So you're injecting a class into the outer scope. So... why aren't you
>>> using `struct/class` as the keyword here? OK, yes, I know why; because that
>>> already has a different meaning (thanks to C): `class topLect` is
>>> equivalent to just `topLeft`, and changing that is problematic.
>>>
>>> The issue with injection is just that... you're not buying much. The
>>> code for these manifested types is ultimately trivial in size. So what's
>>> wrong with people just writing it out and making their code look like
>>> regular code?
>>>
>>> Another problem with it reminds me of the debates surrounding returning
>>> anonymous structures. The idea was only really useful when these structures
>>> were one-offs, where there was exactly one function that returned that
>>> struct. Well, it turns out that this is not the case a lot of times. While
>>> having `map::insert` return `pair`s is obviously impenetrable in terms of
>>> meaning, returning an anonymous struct isn't nearly as good as having it
>>> return a *named* structure. Why? Because every overload of `insert` on *every
>>> associative container* (ordered or not) needs to return the same struct
>>> that has the same meaning.
>>>
>>> So give it a *name* already.
>>>
>>> And that's one of the issues I have here. `std::in_place_t<T>` is used
>>> by several constructors across several objects. And because it isn't tied
>>> to those specific constructors in any way, any code that needs similar
>>> in-place construction functionality can employ it. The standard defines
>>> other tags that it reuses frequently, like `allocator_arg_t` and the like.
>>> Ones which non-standard library code can reuse to have the same meaning.
>>>
>>> So your feature would only ever really be useful in cases where you're
>>> dealing with a one-off tag. The problem is that one-offs sometimes... stop
>>> being one-offs.
>>>
>>> I don't contest that one-offs exist. My point is that they're
>>> sufficiently rare that we don't need grammar just to handle them. And by
>>> creating grammar just to handle them, you're encouraging the creation of
>>> one-offs for non-one-off problems.
>>>
>>> That's one of the advantages of the templated tag idea.
>>> `std::func_tag<"text">` will always resolve down to the same type. So
>>> multiple functions in different scopes and namespaces can share the same
>>> tag.
>>>
>>> ---
>>>
>>> Now, on to the next part: the usage syntax. This is where I think you've
>>> stumbled onto something.
>>>
>>> OK, so we have `topLeft:{}`. That looks like "create an object of a
>>> type". But what is that colon doing there? Why can't you just use
>>> `topLeft{}`?
>>>
>>> Scope.
>>>
>>> *Presumably* (because you never explained what it actually does, so I
>>> have to make assumptions), that colon performs some kind of reverse ADL.
>>> That is, when you find several candidate overloads, you deduce the full
>>> name of the type by matching the base names of the overloads with that one.
>>> Those which don't match are culled. The one that does match now defines the
>>> actual type.
>>>
>>> That way, if you're calling a function in a namespace or nested class,
>>> you don't have to do
>>> `Namespace::OtherNamespace::func(Namespace::OtherNamespace::topLeft{})`.
>>>
>>> And *that* is where we get to something that is potentially useful: the
>>> ability to take a base name of an entity and use the surrounding context to
>>> deduce the full pathname of that entity.
>>>
>>> This has wider implications than just your use case. This could allow
>>> `switch/case` operations over an `enum class` to no longer be required to
>>> repeat the enumeration name at each `case` label (obviously you can't use
>>> your `:` syntax if we want to allow that). And many other things can now be
>>> simplified.
>>>
>>> However, defining its behavior correctly is complicated, a complexity
>>> approaching list initialization. It impacts function overload resolution,
>>> which is a *titanic* can of worms. But if you can do it, and if you can
>>> find a syntax other than `:`, it could be significant. You'd solve not only
>>> this tag issue, but many other verbosity problems.
>>>
>>
>> I have considerably changed the design an you hit many of the issues I
>> changed. I will post anew, probably a new topic
>>
>>
>>>
>>> As for the syntax - I don't care about the declaration, but having the
>>>> possibility to use : instead of comma for the label on the usage site
>>>> is *game changer *in terms of readability and expressiveness
>>>>
>>>> any(in_place<string>: 5, 'A');
>>>>
>>>> This is a *massive* improvement as it is now clear we are opening a
>>>> sub-scope in which we put the arguments
>>>>
>>>
>>> But that's a lie. There is no "sub-scope"; there is no concept of a
>>> "sub-scope" in C++. No book on C++ will explain how "sub-scopes" work
>>> because it does not exist.
>>>
>>> There is only a *convention* that creates the *illusion* of such a
>>> construct. The biggest trap new users fall into when learning anything is
>>> believing that they understand something when they actually *don't*.
>>> Your syntax encourages that; it makes them believe in a concept that
>>> doesn't actually exist.
>>>
>>> Conventions are fine. But conventions that make people believe in
>>> falsehoods are not fine.
>>>
>>> And personally, I fail to see how `any(in_place<string>, 5, 'A')` is any
>>> harder to understand than your colon syntax. Remember: `in_place` is a
>>> variable, not a type
>>> <https://en.cppreference.com/w/cpp/utility/in_place>. Thanks to
>>> variable concepts, we no longer need the `{}` on tags.
>>>
>>> You analogized your syntax with structured binding. And you're right;
>>> the right bit of syntactic sugar can make some things significantly more
>>> useful. But structured binding removed *lots* of syntax at every use of
>>> the members. This is especially true of `tuple`-like types; all of those
>>> `std::get<>` calls are huge and bulky. Structured binding pays for itself
>>> in convenience.
>>>
>>> Your syntax takes `{},` and replaces it with `:` (scoping issues aside).
>>> The removal of two characters cannot even *begin* to compete with the
>>> improvement that structured binding provides. And that's ignoring the
>>> inconsistency it creates.
>>>
>>
>> Here we disagree.
>> For me the diff to any(in_place<string>: 5, 'A')is massive, it really
>> is.
>>
>> First and foremost,
>> you are fine here, *because* *you know the API*, on a alien api it will
>> give measurable boost in understanding!
>>
>> And do you think a first time user will understand any(in_place<string>,
>> 5, 'A')?
>> Not a chance - he will be baffled, but with colon it is clear that it is
>> some sort of clarification.
>>
>
>
> First, it's not "some sort of clarification". It's a *variable*. Again,
> don't lie to programmers.
>
Semantically they are not. *But lets pretend they are*. They are "*label
arguments*".
*"Label arguments" are separated by colon, not by comma.* *That's it*. This
new rule add material value that makes the difference b/w
"The coach, the team did a great job" and "The coach: the team did a great
job"
It is absolutely fundamental to be able to read labels arguments as such.
>
> Second, I think you consistently underestimate new users. Telling them
> that there is a variable called `std::in_place<T>` is not something that's
> going to confuse and frighten them. It's not something they have to learn
> via route.
>
> Third, I think you forget that, sooner or later, new users are going to
> have to learn to read a series of constructor declarations and figure out
> what's going on. Which means they'll need to read `std::variant`'s
> constructors and work out how to call them.
>
> If they've seen `in_place<T>` before, if they understand that it's a
> variable and what it is used for, then they can understand how to employ it
> when they see that `variant` has some constructors that take
> `std::in_place_t<T>` as a type.
>
> In your world of "notation", they don't know how to translate from a
> function declaration into a set of arguments properly. They learned
> `in_place<T>` by convention, not by understanding what it actually is. So
> when they see a function that takes `std::in_place_t<T>`, they don't really
> know what to do with that or how to get a value of that type.
>
This is good point - a user reading the decl should know how to use the
interface.
Ironically in the current scenario he does not, not without reading the
documentation!
in_place_t does *not* imply in_place,
sequenced_policy does *not *imply par
And the opposite is also true, on the call side a in_place is *not*
indicated to be special in any way!!! You know it because you learn it!
Reading some else's library you will have hard time tracking what is
special variable and what is not.
This is why current tag mechanism is Bad API, though it is powerful in may
other ways. And that's why no one is using it until he really, really has
to.
My goal is to have it both ways - *self-explanatory* , trivial to declare
API + all the benefits, *at the cost* of "new type" of argument
(syntactically, technically it is not so new)
> That is what I meant by implementation detail - to read the code it is
>> *better* *to* *ignore* the fact (or simply *not to know*) this is
>> argument passing.
>>
>
> For whom is it better? For the person reading the code? For the person
> writing it? For your hypothetical new user that doesn't understand that
> global variables exist?
>
> The fact that it is a value being used to control overload resolution is
> important. It's what allows forwarding to work. And that's something new
> users ought to be introduced to.
>
> Your hypothetical new user that doesn't understand that global variables
> exist will have a hard time understanding how
> `vector<any>::emplace_back(in_place<string>: 5, 'a')` works, because they
> don't recognize `in_place` as something being passed. They only recognize
> it as a piece of syntax that `any` uses; how that syntax gets transmitted
> is unclear to them.
>
A new user must first understated what it does, not how it works. Using
labels immensely adds to that.
>
> Sure, they know that it works. But without knowing *why*, they cannot
> stop being new users.
>
> There's a common phrase that typifies this: lies to children. Telling new
> people, not merely a simplified view of the world, but an easy-to-digest
> view that is ultimately wrong. Some lies told to children are fine;
> learning Newtonian mechanics is OK, because they're close enough to being
> right that only certain fields of study run into cases where it isn't.
>
> This is not like that.
>
> It is better to read it as "thing: foo, bar", then "thing, foo, bar".
>> It is purely human language thing - the brain MUST stop reading a list
>> and start reading a clarification. The fact that under it is an arg is an
>> impl detail.
>>
>> Same with structured bindings - the fact that these are NOT variables but
>> members is not important - they must be read as vars.
>>
>
> Except of course when that fact suddenly becomes relevant, like when you
> use `decltype` on them. Or when you want to *capture* them in a lambda
> (which BTW, you can't do right now).
>
> Also, it should be noted how many questions get asked about the oddities
> of structured bindings' "variables".
>
> Lies have costs. And while structured binding has costs, it has paid for
> them twice over in usability. I do not see a mere colon doing the same.
>
You ignore the very good examples I gave you, where using a comma is
practically impossible.
> Second
>>
>> The fact that it *semantically* is not an argument (it is a
>> clarification) opens the possibility to use names otherwise confusing or
>> even wrong
>>
>> rect(center, {12,12}); //< size is default
>>
>> Horrible, It reads *we* *pass center va**riable and a size 12x12*
>>
>
> But that's literally *what you're doing*. You're arguing for a syntax
> that hides what you're doing.
>
rect(center, {12,12}); //< uses rect(Point, Size),
// 'center' is a local variable
// creates rect with topLeft at 'center', size is
12x12
rect(center: {12,12}); //< uses labeled ctor,
// creates a rect with topLeft at -6,-6, size is
default
You see way we *must* use different syntax to differentiate b/w
"global/special/labeled" arguments and regular ones?
Colon just happens to be the best one.
If we *don't* use colon, we are selling ourselfs short - we lose named
constructors altogether.
People will continue to use rect::from_center({12,12})
And we both know that is far, far from ideal
And BTW rect(center: center); also "just works". How cool is that.
>
> QString(number, 100)
>>
>> Hum...
>>
>> image(data, buffer, 12)
>> image(clone, background)
>>
>> Hum, hum...
>>
>
> I don't see how adding a colon improves any of these cases. Without
> context, I have no idea what any of these functions or constructors or
> whatever are doing.
>
> write(commit, package)
>>
>> The point is - if we take away the sematic disambiguation ("a note" vs "a
>> list item") we inflict *massive* damage. Some interfaces become
>> *impossible,* not technically, but practically.
>>
>> In that sense, *the colon alone* is enabling technology, much like
>> "separate variables" in structured bindings.
>>
>
> I fail to see that. `rect(center: {12, 12})`
>
>
>> Separate variables give us "multiple return types", a colon gives us
>> "named constructors" (and more).
>>
>
>
> The problem I have with this analogy is simply the relative cost of the
> two constructs. `get<>` is huge, bulky, annoying, and has to be done every
> time you access the member of an MRV function that returned a tuple.
>
> A comma is none of that. Structured binding purchases its place in C++ by
> taking huge, complex, and ugly syntax and making it big. Yours takes
> `rect(center, {12, 12})` and turns it into `rect(center: {12, 12})`.
>
> There's no comparison; structured binding solves a much bigger problem
> than your syntax. Your syntax is purely a rotational improvement. And
> that's if we accept the premise that it's an improvement.
>
Yet, structured bindings are not enabling technology, but this, if done
right, is. It is not about the number of chars - its about new ways to
express an interface.
--
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/c433a80b-953d-4bbe-a12f-0ec8b461c63d%40isocpp.org.
------=_Part_64027_1761069942.1531381414473
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Thursday, July 12, 2018 at 2:33:51 AM UTC+3, Ni=
col Bolas 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"lt=
r">On Wednesday, July 11, 2018 at 3:09:54 PM UTC-4, <a>mihailn...@gmail.com=
</a> 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">On Wedn=
esday, July 11, 2018 at 6:38:58 PM UTC+3, Nicol Bolas wrote:<blockquote cla=
ss=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc=
solid;padding-left:1ex"><div dir=3D"ltr">On Wednesday, July 11, 2018 at 4:=
51:01 AM UTC-4, <a>mihailn...@gmail.com</a> wrote:<blockquote class=3D"gmai=
l_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;pad=
ding-left:1ex"><div dir=3D"ltr"><div></div><div>I think I know where the pr=
oblem is - we don't need to express label arguments in terms of a varia=
ble but in <i>terms of a type!</i></div><div><i></i><br></div><div>Look:</d=
iv><div><br></div><div><font face=3D"courier new,monospace">rect(case tople=
ft, Point p, Size sz); //< or whatever syntax</font></div><div><b></b><i=
></i><u></u><sub></sub><sup></sup><strike></strike><br></div><div>usage:</d=
iv><div><br></div><div><font face=3D"courier new,monospace">auto r =3D rect=
(topLeft: {}, {10, 10});=C2=A0</font></div><div><font face=3D"courier new,m=
onospace"><br></font></div><div><font face=3D"arial,sans-serif"><br></font>=
</div><div><font face=3D"arial,sans-serif">is transformed to=C2=A0</font></=
div><div><font face=3D"arial,sans-serif"><br></font></div><div><font face=
=3D"courier new,monospace">class topLeft {};</font></div><div><font face=3D=
"courier new,monospace"><br></font></div><div><font face=3D"arial,sans-seri=
f"><span style=3D"display:inline!important;float:none;background-color:tran=
sparent;color:rgb(34,34,34);font-family:courier new,monospace;font-size:13p=
x;font-style:normal;font-variant:normal;font-weight:400;letter-spacing:norm=
al;text-align:left;text-decoration:none;text-indent:0px;text-transform:none=
;white-space:normal;word-spacing:0px">rect(topLeft, Point p , Size sz);</sp=
an></font></div><div><font face=3D"arial,sans-serif"><b></b><i></i><u></u><=
sub></sub><sup></sup><strike></strike><br></font></div><div><font face=3D"a=
rial,sans-serif"><span style=3D"display:inline!important;float:none;backgro=
und-color:transparent;color:rgb(34,34,34);font-family:"Arial",&qu=
ot;Helvetica",sans-serif;font-size:13px;font-style:normal;font-variant=
:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decorati=
on:none;text-indent:0px;text-transform:none;white-space:normal;word-spacing=
:0px">usage <span style=3D"display:inline!important;float:none;background-c=
olor:transparent;color:rgb(34,34,34);font-family:arial,sans-serif;font-size=
:13px;font-style:normal;font-variant:normal;font-weight:400;letter-spacing:=
normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:=
none;white-space:normal;word-spacing:0px">is transformed to=C2=A0</span>:</=
span></font></div><div><font face=3D"arial,sans-serif"><b></b><i></i><u></u=
><sub></sub><sup></sup><strike></strike><br></font></div><div><font face=3D=
"arial,sans-serif"><span style=3D"display:inline!important;float:none;backg=
round-color:transparent;color:rgb(34,34,34);font-family:courier new,monospa=
ce;font-size:13px;font-style:normal;font-variant:normal;font-weight:400;let=
ter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;tex=
t-transform:none;white-space:normal;word-spacing:0px">auto r =3D rect(topLe=
ft{}, {}, {10, 10});</span></font></div><div><font face=3D"arial,sans-serif=
"><b></b><i></i><u></u><sub></sub><sup></sup><strike></strike><br></font></=
div><div><font face=3D"arial,sans-serif"><br></font></div></div></blockquot=
e><div><br></div><div>I don't much like it, but I think it's moving=
in a useful direction.</div><div><br></div><div>Let's start with the f=
unction declaration syntax. I don't really see the point of it.</div><d=
iv><br></div><div>So you're injecting a class into the outer scope. So.=
... why aren't you using `struct/class` as the keyword here? OK, yes, I =
know why; because that already has a different meaning (thanks to C): `clas=
s topLect` is equivalent to just `topLeft`, and changing that is problemati=
c.</div><div><br></div><div>The issue with injection is just that... you=
9;re not buying much. The code for these manifested types is ultimately tri=
vial in size. So what's wrong with people just writing it out and makin=
g their code look like regular code?<br></div><div></div><div><br></div><di=
v>Another problem with it reminds me of the debates surrounding returning a=
nonymous structures. The idea was only really useful when these structures =
were one-offs, where there was exactly one function that returned that stru=
ct. Well, it turns out that this is not the case a lot of times. While havi=
ng `map::insert` return `pair`s is obviously impenetrable in terms of meani=
ng, returning an anonymous struct isn't nearly as good as having it ret=
urn a <i>named</i> structure. Why? Because every overload of `insert` on <i=
>every associative container</i> (ordered or not) needs to return the same =
struct that has the same meaning.</div><div><br></div><div>So give it a <i>=
name</i> already.</div><div><br></div><div>And that's one of the issues=
I have here. `std::in_place_t<T>` is used by several constructors ac=
ross several objects. And because it isn't tied to those specific const=
ructors in any way, any code that needs similar in-place construction funct=
ionality can employ it. The standard defines other tags that it reuses freq=
uently, like `allocator_arg_t` and the like. Ones which non-standard librar=
y code can reuse to have the same meaning.</div><div><br></div><div>So your=
feature would only ever really be useful in cases where you're dealing=
with a one-off tag. The problem is that one-offs sometimes... stop being o=
ne-offs.</div><div><br></div><div>I don't contest that one-offs exist. =
My point is that they're sufficiently rare that we don't need gramm=
ar just to handle them. And by creating grammar just to handle them, you=
9;re encouraging the creation of one-offs for non-one-off problems.</div><d=
iv><br></div><div>That's one of the advantages of the templated tag ide=
a. `std::func_tag<"text">` will always resolve down to the =
same type. So multiple functions in different scopes and namespaces can sha=
re the same tag.</div><div><br></div><div>---</div><div><br></div><div>Now,=
on to the next part: the usage syntax. This is where I think you've st=
umbled onto something.</div><div><br></div><div>OK, so we have `topLeft:{}`=
.. That looks like "create an object of a type". But what is that =
colon doing there? Why can't you just use `topLeft{}`?</div><div><br></=
div><div>Scope.</div><div><br></div><div><i>Presumably</i> (because you nev=
er explained what it actually does, so I have to make assumptions), that co=
lon performs some kind of reverse ADL. That is, when you find several candi=
date overloads, you deduce the full name of the type by matching the base n=
ames of the overloads with that one. Those which don't match are culled=
.. The one that does match now defines the actual type.</div><div><br></div>=
<div>That way, if you're calling a function in a namespace or nested cl=
ass, you don't have to do `Namespace::OtherNamespace::<wbr>func(Namespa=
ce::<wbr>OtherNamespace::topLeft{})`.</div><div><br></div><div>And <i>that<=
/i> is where we get to something that is potentially useful: the ability to=
take a base name of an entity and use the surrounding context to deduce th=
e full pathname of that entity.</div><div><br></div><div>This has wider imp=
lications than just your use case. This could allow `switch/case` operation=
s over an `enum class` to no longer be required to repeat the enumeration n=
ame at each `case` label (obviously you can't use your `:` syntax if we=
want to allow that). And many other things can now be simplified.</div><di=
v><br></div><div>However, defining its behavior correctly is complicated, a=
complexity approaching list initialization. It impacts function overload r=
esolution, which is a <i>titanic</i> can of worms. But if you can do it, an=
d if you can find a syntax other than `:`, it could be significant. You'=
;d solve not only this tag issue, but many other verbosity problems.<br></d=
iv></div></blockquote><div><br></div><div>I have considerably changed the d=
esign an you hit many of the issues I changed. I will post anew, probably a=
new topic</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"><d=
iv dir=3D"ltr"><div></div><div></div><div><br></div><blockquote class=3D"gm=
ail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;p=
adding-left:1ex"><div dir=3D"ltr"><div><font face=3D"arial,sans-serif"></fo=
nt></div><div><font face=3D"arial,sans-serif"></font></div><div><font face=
=3D"arial,sans-serif">As for the syntax - I don't care about the declar=
ation, but having the possibility to use <font face=3D"courier new,monospac=
e">:</font> instead of comma for the label on the usage site is <i>game cha=
nger </i>in terms of readability and expressiveness =C2=A0=C2=A0</font></di=
v><div><font face=3D"arial,sans-serif"><br></font></div><div><font face=3D"=
courier new,monospace">any(in_place<string>: 5, 'A');</font><=
/div><div><font face=3D"courier new,monospace"><br></font></div><div><font =
face=3D"arial,sans-serif">This is a <i>massive</i> improvement as it is now=
clear we are opening a sub-scope in which we put the arguments</font></div=
></div></blockquote><div><br></div><div>But that's a lie. There is no &=
quot;sub-scope"; there is no concept of a "sub-scope" in C++=
.. No book on C++ will explain how "sub-scopes" work because it do=
es not exist.</div><div><br></div><div>There is only a <i>convention</i> th=
at creates the <i>illusion</i> of such a construct. The biggest trap new us=
ers fall into when learning anything is believing that they understand some=
thing when they actually <i>don't</i>. Your syntax encourages that; it =
makes them believe in a concept that doesn't actually exist.</div><div>=
<br></div><div>Conventions are fine. But conventions that make people belie=
ve in falsehoods are not fine.<br></div><div><br></div><div>And personally,=
I fail to see how `any(in_place<string>, 5, 'A')` is any har=
der to understand than your colon syntax. Remember: <a onmousedown=3D"this.=
href=3D'https://www.google.com/url?q\x3dhttps%3A%2F%2Fen.cppreference.c=
om%2Fw%2Fcpp%2Futility%2Fin_place\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNF=
a8KY257P4YtdbmKCdfACsEC6TBQ';return true;" onclick=3D"this.href=3D'=
https://www.google.com/url?q\x3dhttps%3A%2F%2Fen.cppreference.com%2Fw%2Fcpp=
%2Futility%2Fin_place\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFa8KY257P4Ytd=
bmKCdfACsEC6TBQ';return true;" href=3D"https://en.cppreference.com/w/cp=
p/utility/in_place" target=3D"_blank" rel=3D"nofollow">`in_place` is a vari=
able, not a type</a>. Thanks to variable concepts, we no longer need the `{=
}` on tags.</div><div><br></div><div>You analogized your syntax with struct=
ured binding. And you're right; the right bit of syntactic sugar can ma=
ke some things significantly more useful. But structured binding removed <i=
>lots</i> of syntax at every use of the members. This is especially true of=
`tuple`-like types; all of those `std::get<>` calls are huge and bul=
ky. Structured binding pays for itself in convenience.<br></div><div><br></=
div><div>Your syntax takes `{},` and replaces it with `:` (scoping issues a=
side). The removal of two characters cannot even <i>begin</i> to compete wi=
th the improvement that structured binding provides. And that's ignorin=
g the inconsistency it creates.</div></div></blockquote><div><br></div><div=
>Here we disagree.=C2=A0</div><div>For me the diff to<span style=3D"text-al=
ign:left;color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spa=
cing:normal;font-size:13px;font-style:normal;font-variant:normal;font-weigh=
t:400;text-decoration:none;word-spacing:0px;display:inline!important;white-=
space:normal;float:none;background-color:transparent"><font face=3D"courier=
new,monospace"> <span style=3D"text-align:left;color:rgb(34,34,34);text-tr=
ansform:none;text-indent:0px;letter-spacing:normal;font-size:13px;font-styl=
e:normal;font-variant:normal;font-weight:400;text-decoration:none;word-spac=
ing:0px;display:inline!important;white-space:normal;float:none;background-c=
olor:transparent">any(in_place<string>: 5, 'A')<font face=3D"=
arial,sans-serif">is massive, it really is.=C2=A0</font></span></font></spa=
n></div><div><span style=3D"text-align:left;color:rgb(34,34,34);text-transf=
orm:none;text-indent:0px;letter-spacing:normal;font-size:13px;font-style:no=
rmal;font-variant:normal;font-weight:400;text-decoration:none;word-spacing:=
0px;display:inline!important;white-space:normal;float:none;background-color=
:transparent"><font face=3D"courier new,monospace"><span style=3D"text-alig=
n:left;color:rgb(34,34,34);text-transform:none;text-indent:0px;letter-spaci=
ng:normal;font-size:13px;font-style:normal;font-variant:normal;font-weight:=
400;text-decoration:none;word-spacing:0px;display:inline!important;white-sp=
ace:normal;float:none;background-color:transparent"><font face=3D"arial,san=
s-serif"><br></font></span></font></span></div><div><font face=3D"arial,san=
s-serif">First and foremost,</font></div><div><font face=3D"arial,sans-seri=
f">you are fine here, <i>because</i> <i>you know the API</i>, on a alien ap=
i it will give measurable boost in understanding!</font></div><div><font fa=
ce=3D"arial,sans-serif"><br></font></div><div><font face=3D"arial,sans-seri=
f">And do you think a first time user will understand </font><font face=3D"=
courier new,monospace">a</font><span style=3D"text-align:left;color:rgb(34,=
34,34);text-transform:none;text-indent:0px;letter-spacing:normal;font-size:=
13px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:=
none;word-spacing:0px;display:inline!important;white-space:normal;float:non=
e;background-color:transparent"><font face=3D"courier new,monospace">ny(in_=
place<string>, 5, 'A')</font><font face=3D"arial,sans-serif">=
?</font></span><span style=3D"text-align:left;color:rgb(34,34,34);text-tran=
sform:none;text-indent:0px;letter-spacing:normal;font-size:13px;font-style:=
normal;font-variant:normal;font-weight:400;text-decoration:none;word-spacin=
g:0px;display:inline!important;white-space:normal;float:none;background-col=
or:transparent"><br></span></div><div><font face=3D"courier new,monospace">=
<span style=3D"text-align:left;color:rgb(34,34,34);text-transform:none;text=
-indent:0px;letter-spacing:normal;font-size:13px;font-style:normal;font-var=
iant:normal;font-weight:400;text-decoration:none;word-spacing:0px;display:i=
nline!important;white-space:normal;float:none;background-color:transparent"=
><font face=3D"arial,sans-serif">Not a chance - he will be baffled, but wit=
h colon it is clear that it is some sort of clarification.</font></span></f=
ont></div></div></blockquote><div><br></div></div></blockquote><div>=C2=A0<=
/div><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8e=
x;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div></d=
iv><div>First, it's not "some sort of clarification". It'=
s a <i>variable</i>. Again, don't lie to programmers.</div></div></bloc=
kquote><div><br></div><div>Semantically they are not. <i>But lets pretend t=
hey are</i>. They are "<i>label arguments</i>".</div><div><i>=C2=
=A0</i></div><div><i>"Label arguments" are separated by colon, no=
t by comma.</i> <i>That's it</i>. This new rule add material value that=
makes the difference b/w</div><div><br></div><div>"The coach, the tea=
m did a great job" and=C2=A0<span style=3D"display: inline !important;=
float: none; background-color: transparent; color: rgb(34, 34, 34); font-f=
amily: "Arial","Helvetica",sans-serif; 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: no=
rmal; word-spacing: 0px;">"The coach: the team did a great job"</=
span></div><div><span style=3D"display: inline !important; float: none; bac=
kground-color: transparent; color: rgb(34, 34, 34); font-family: "Aria=
l","Helvetica",sans-serif; font-size: 13px; font-style: norm=
al; font-variant: normal; font-weight: 400; letter-spacing: normal; orphans=
: 2; 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;"><br></span></div><div><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; orphans: 2; 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;">It is absolutely fundamental to be able to read lab=
els arguments as such.=C2=A0</span></div><div>=C2=A0</div><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>Second, I =
think you consistently underestimate new users. Telling them that there is =
a variable called `std::in_place<T>` is not something that's goin=
g to confuse and frighten them. It's not something they have to learn v=
ia route.</div><div><br></div><div>Third, I think you forget that, sooner o=
r later, new users are going to have to learn to read a series of construct=
or declarations and figure out what's going on. Which means they'll=
need to read `std::variant`'s constructors and work out how to call th=
em.</div><div><br></div><div>If they've seen `in_place<T>` before=
, if they understand that it's a variable and what it is used for, then=
they can understand how to employ it when they see that `variant` has some=
constructors that take `std::in_place_t<T>` as a type.</div><div><br=
></div><div>In your world of "notation", they don't know how =
to translate from a function declaration into a set of arguments properly. =
They learned `in_place<T>` by convention, not by understanding what i=
t actually is. So when they see a function that takes `std::in_place_t<T=
>`, they don't really know what to do with that or how to get a valu=
e of that type.<br></div></div></blockquote><div>=C2=A0</div><div>This is g=
ood point - a user reading the decl should know how to use the interface.=
=C2=A0</div><div><br></div><div>Ironically in the current scenario he does =
not, not without reading the documentation!</div><div><br></div><div><font =
face=3D"courier new,monospace">in_place_t </font>does <i>not</i> imply=C2=
=A0 <font face=3D"courier new,monospace">in_place</font>,=C2=A0</div><div><=
font face=3D"courier new,monospace">sequenced_policy</font> does <i>not </i=
>imply <font face=3D"courier new,monospace">par</font><br></div><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><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>And the opposite is also true, on the call side a=
=C2=A0<font face=3D"courier new,monospace">in_place</font><font face=3D"ari=
al,sans-serif"> is <i>not</i> indicated to be special in any way!!! You kno=
w it because you learn it!</font></div><div><font face=3D"arial,sans-serif"=
><br></font></div><div><font face=3D"arial,sans-serif">Reading some else=
9;s library you will have hard time tracking what is special variable and w=
hat is not.</font></div><div><b></b><i></i><u></u><sub></sub><sup></sup><st=
rike></strike><font face=3D"courier new,monospace"></font><font face=3D"ari=
al,sans-serif"></font><font face=3D"arial,sans-serif"></font><br></div><div=
>This is why current tag mechanism is Bad API, though it is powerful in may=
other ways. And that's why no one is using it until he really, really =
has to.</div><div><br></div><div>My goal is to have it both ways - <i>self-=
explanatory</i> , trivial to declare API + all the benefits, <i>at the cost=
</i> of "new type" of argument (syntactically, technically it is =
not so new)</div><div><br></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></div><div><br></div><blockquote class=3D"gmail_quo=
te" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-=
left:1ex"><div dir=3D"ltr"><div><font face=3D"courier new,monospace"><span =
style=3D"text-align:left;color:rgb(34,34,34);text-transform:none;text-inden=
t:0px;letter-spacing:normal;font-size:13px;font-style:normal;font-variant:n=
ormal;font-weight:400;text-decoration:none;word-spacing:0px;display:inline!=
important;white-space:normal;float:none;background-color:transparent"><font=
face=3D"arial,sans-serif"></font></span></font></div><div><font face=3D"co=
urier new,monospace"><span style=3D"text-align:left;color:rgb(34,34,34);tex=
t-transform:none;text-indent:0px;letter-spacing:normal;font-size:13px;font-=
style:normal;font-variant:normal;font-weight:400;text-decoration:none;word-=
spacing:0px;display:inline!important;white-space:normal;float:none;backgrou=
nd-color:transparent"><font face=3D"arial,sans-serif">That is what I meant =
by implementation detail - to read the code it is <i>better</i> <i>to</i> <=
i>ignore</i> the fact (or simply <i>not to know</i>) this is argument passi=
ng.</font></span></font></div></div></blockquote><div><br></div></div></blo=
ckquote><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>=
</div><div>For whom is it better? For the person reading the code? For the =
person writing it? For your hypothetical new user that doesn't understa=
nd that global variables exist?</div><div><br></div><div>The fact that it i=
s a value being used to control overload resolution is important. It's =
what allows forwarding to work. And that's something new users ought to=
be introduced to.</div><div><br></div><div>Your hypothetical new user that=
doesn't understand that global variables exist will have a hard time u=
nderstanding how `vector<any>::emplace_back(in_<wbr>place<string&g=
t;: 5, 'a')` works, because they don't recognize `in_place` as =
something being passed. They only recognize it as a piece of syntax that `a=
ny` uses; how that syntax gets transmitted is unclear to them.</div></div><=
/blockquote><div>=C2=A0</div><div>A new user must first understated what it=
does, not how it works. Using labels immensely adds to that.</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>Sure, they know that it works. But without knowing <i>why</=
i>, they cannot stop being new users.<br></div><div><br></div><div>There=
9;s a common phrase that typifies this: lies to children. Telling new peopl=
e, not merely a simplified view of the world, but an easy-to-digest view th=
at is ultimately wrong. Some lies told to children are fine; learning Newto=
nian mechanics is OK, because they're close enough to being right that =
only certain fields of study run into cases where it isn't.</div><div><=
br></div><div>This is not like that.=C2=A0</div></div></blockquote><blockqu=
ote 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></div><div><br><=
/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><font fa=
ce=3D"courier new,monospace"><span style=3D"text-align:left;color:rgb(34,34=
,34);text-transform:none;text-indent:0px;letter-spacing:normal;font-size:13=
px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:no=
ne;word-spacing:0px;display:inline!important;white-space:normal;float:none;=
background-color:transparent"><font face=3D"arial,sans-serif"></font></span=
></font></div><div><span style=3D"text-align:left;color:rgb(34,34,34);text-=
transform:none;text-indent:0px;letter-spacing:normal;font-size:13px;font-st=
yle:normal;font-variant:normal;font-weight:400;text-decoration:none;word-sp=
acing:0px;display:inline!important;white-space:normal;float:none;background=
-color:transparent"><font face=3D"courier new,monospace"><font face=3D"aria=
l,sans-serif">It is </font></font>better <font face=3D"courier new,monospac=
e"><font face=3D"arial,sans-serif">to read it as "<font face=3D"courie=
r new,monospace">thing: foo, bar</font>", then <span style=3D"display:=
inline!important;float:none;background-color:transparent;color:rgb(34,34,34=
);font-family:arial,sans-serif;font-size:13px;font-style:normal;font-varian=
t:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decorat=
ion:none;text-indent:0px;text-transform:none;white-space:normal;word-spacin=
g:0px">"<font face=3D"courier new,monospace">thing, foo, bar</font>&qu=
ot;</span>.=C2=A0</font></font></span><font face=3D"courier new,monospace">=
<span style=3D"text-align:left;color:rgb(34,34,34);text-transform:none;text=
-indent:0px;letter-spacing:normal;font-size:13px;font-style:normal;font-var=
iant:normal;font-weight:400;text-decoration:none;word-spacing:0px;display:i=
nline!important;white-space:normal;float:none;background-color:transparent"=
><font face=3D"arial,sans-serif"><br></font></span></font></div><div><font =
face=3D"courier new,monospace"><span style=3D"text-align:left;color:rgb(34,=
34,34);text-transform:none;text-indent:0px;letter-spacing:normal;font-size:=
13px;font-style:normal;font-variant:normal;font-weight:400;text-decoration:=
none;word-spacing:0px;display:inline!important;white-space:normal;float:non=
e;background-color:transparent"><font face=3D"arial,sans-serif">It is purel=
y human language thing - the brain MUST stop reading a list and start readi=
ng a clarification. The fact that under it is an arg is an impl detail.</fo=
nt></span></font></div><div><font face=3D"courier new,monospace"><span styl=
e=3D"text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0p=
x;letter-spacing:normal;font-size:13px;font-style:normal;font-variant:norma=
l;font-weight:400;text-decoration:none;word-spacing:0px;display:inline!impo=
rtant;white-space:normal;float:none;background-color:transparent"><font fac=
e=3D"arial,sans-serif"><br></font></span></font></div><div><font face=3D"co=
urier new,monospace"><span style=3D"text-align:left;color:rgb(34,34,34);tex=
t-transform:none;text-indent:0px;letter-spacing:normal;font-size:13px;font-=
style:normal;font-variant:normal;font-weight:400;text-decoration:none;word-=
spacing:0px;display:inline!important;white-space:normal;float:none;backgrou=
nd-color:transparent"><font face=3D"arial,sans-serif">Same with structured =
bindings - the fact that these are NOT variables but members is not importa=
nt - they must be read as vars.</font></span></font></div></div></blockquot=
e><div><br></div></div></blockquote><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></div><div>Except of course when that fact sudd=
enly becomes relevant, like when you use `decltype` on them. Or when you wa=
nt to <i>capture</i> them in a lambda (which BTW, you can't do right no=
w).<br></div><div><br></div><div>Also, it should be noted how many question=
s get asked about the oddities of structured bindings' "variables&=
quot;.</div><div><br></div><div>Lies have costs. And while structured bindi=
ng has costs, it has paid for them twice over in usability. I do not see a =
mere colon doing the same.<br></div></div></blockquote><div>=C2=A0</div><di=
v>You ignore the very good examples I gave you, where using a comma is prac=
tically impossible.=C2=A0</div><div><br></div><blockquote class=3D"gmail_qu=
ote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padd=
ing-left: 1ex;"><div dir=3D"ltr"><div></div><div><br></div><blockquote clas=
s=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc =
solid;padding-left:1ex"><div dir=3D"ltr"><div><font face=3D"arial,sans-seri=
f"><b></b><i></i><u></u><sub></sub><sup></sup><strike></strike><font face=
=3D"courier new,monospace"></font></font></div><div><font face=3D"arial,san=
s-serif">Second</font></div><div><font face=3D"arial,sans-serif"><br></font=
></div><div><font face=3D"arial,sans-serif">The fact that it <i>semanticall=
y</i> is not an argument (it is a clarification) opens the possibility to u=
se names otherwise confusing or even wrong</font></div><div><font face=3D"a=
rial,sans-serif"><br></font></div><div><font face=3D"courier new,monospace"=
>rect(center, {12,12}); //< size is default</font></div><div><span style=
=3D"text-align:left;color:rgb(34,34,34);text-transform:none;text-indent:0px=
;letter-spacing:normal;font-size:13px;font-style:normal;font-variant:normal=
;font-weight:400;text-decoration:none;word-spacing:0px;display:inline!impor=
tant;white-space:normal;float:none;background-color:transparent"><font face=
=3D"courier new,monospace"><span style=3D"text-align:left;color:rgb(34,34,3=
4);text-transform:none;text-indent:0px;letter-spacing:normal;font-size:13px=
;font-style:normal;font-variant:normal;font-weight:400;text-decoration:none=
;word-spacing:0px;display:inline!important;white-space:normal;float:none;ba=
ckground-color:transparent"><font face=3D"arial,sans-serif"><font face=3D"c=
ourier new,monospace"></font><br></font></span></font></span></div><div><fo=
nt face=3D"arial,sans-serif">Horrible, It reads <i>we</i> <i>pass center va=
</i></font><i>riable and a size 12x12</i></div></div></blockquote><div><br>=
</div><div>But that's literally <i>what you're doing</i>. You'r=
e arguing for a syntax that hides what you're doing.<br></div></div></b=
lockquote><div><br></div><div><span style=3D"display: inline !important; fl=
oat: none; background-color: transparent; color: rgb(34, 34, 34); font-fami=
ly: "Arial","Helvetica",sans-serif; font-size: 13px; fo=
nt-style: normal; font-variant: normal; font-weight: 400; letter-spacing: n=
ormal; orphans: 2; 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></span></div><div><span style=3D"text-align: lef=
t; color: rgb(34, 34, 34); text-transform: none; text-indent: 0px; letter-s=
pacing: normal; font-family: "Arial","Helvetica",sans-s=
erif; font-size: 13px; font-variant: normal; word-spacing: 0px; display: in=
line !important; white-space: normal; orphans: 2; float: none; -webkit-text=
-stroke-width: 0px; background-color: transparent;"><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-styl=
e: 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;">rect(center, {12,12}); //< uses rect(Point, Size),=C2=A0=
</span></span></div><div><span style=3D"text-align: left; color: rgb(34, 34=
, 34); text-transform: none; text-indent: 0px; letter-spacing: normal; font=
-family: "Arial","Helvetica",sans-serif; font-size: 13p=
x; font-variant: normal; word-spacing: 0px; display: inline !important; whi=
te-space: normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; =
background-color: transparent;"><span style=3D"display: inline !important; =
float: none; background-color: transparent; color: rgb(34, 34, 34); font-fa=
mily: courier new,monospace; font-size: 13px; font-style: normal; font-vari=
ant: normal; font-weight: 400; letter-spacing: normal; orphans: 2; text-ali=
gn: left; text-decoration: none; text-indent: 0px; text-transform: none; -w=
ebkit-text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
=C2=A0 // 'center' is a local variable</span></span></div><div><spa=
n style=3D"text-align: left; color: rgb(34, 34, 34); text-transform: none; =
text-indent: 0px; letter-spacing: normal; font-family: "Arial",&q=
uot;Helvetica",sans-serif; font-size: 13px; font-variant: normal; word=
-spacing: 0px; display: inline !important; white-space: normal; orphans: 2;=
float: none; -webkit-text-stroke-width: 0px; background-color: transparent=
;"><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;">=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 // creates rect with to=
pLeft at 'center', size is 12x12</span></span></div><div><span styl=
e=3D"text-align: left; color: rgb(34, 34, 34); text-transform: none; text-i=
ndent: 0px; letter-spacing: normal; font-family: "Arial","He=
lvetica",sans-serif; font-size: 13px; font-variant: normal; word-spaci=
ng: 0px; display: inline !important; white-space: normal; orphans: 2; float=
: none; -webkit-text-stroke-width: 0px; background-color: transparent;"><br=
></span></div><div><span style=3D"text-align: left; color: rgb(34, 34, 34);=
text-transform: none; text-indent: 0px; letter-spacing: normal; font-famil=
y: "Arial","Helvetica",sans-serif; font-size: 13px; fon=
t-variant: normal; word-spacing: 0px; display: inline !important; white-spa=
ce: normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; backgr=
ound-color: transparent;"><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: n=
ormal; font-weight: 400; letter-spacing: normal; orphans: 2; text-align: le=
ft; text-decoration: none; text-indent: 0px; text-transform: none; -webkit-=
text-stroke-width: 0px; white-space: normal; word-spacing: 0px;">rect(cente=
r: {12,12}); //< uses labeled ctor,=C2=A0</span></span></div><div><span =
style=3D"text-align: left; color: rgb(34, 34, 34); text-transform: none; te=
xt-indent: 0px; letter-spacing: normal; font-family: "Arial",&quo=
t;Helvetica",sans-serif; font-size: 13px; font-variant: normal; word-s=
pacing: 0px; display: inline !important; white-space: normal; orphans: 2; f=
loat: none; -webkit-text-stroke-width: 0px; background-color: transparent;"=
><span style=3D"display: inline !important; float: none; background-color: =
transparent; color: rgb(34, 34, 34); font-family: courier new,monospace; fo=
nt-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; w=
hite-space: normal; word-spacing: 0px;">=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=C2=A0 // creates a rect with <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;">topLeft at -6,-6, size is default</span>=
</span></span></div><div><span style=3D"text-align: left; color: rgb(34, 34=
, 34); text-transform: none; text-indent: 0px; letter-spacing: normal; font=
-family: "Arial","Helvetica",sans-serif; font-size: 13p=
x; font-variant: normal; word-spacing: 0px; display: inline !important; whi=
te-space: normal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; =
background-color: transparent;"><br></span></div><div><span style=3D"text-a=
lign: left; color: rgb(34, 34, 34); text-transform: none; text-indent: 0px;=
letter-spacing: normal; font-family: "Arial","Helvetica&quo=
t;,sans-serif; font-size: 13px; font-variant: normal; word-spacing: 0px; di=
splay: inline !important; white-space: normal; orphans: 2; float: none; -we=
bkit-text-stroke-width: 0px; background-color: transparent;">You see way we=
<i>must</i> use different syntax to differentiate b/w "global/special=
/labeled" arguments and regular ones?</span></div><div><span style=3D"=
text-align: left; color: rgb(34, 34, 34); text-transform: none; text-indent=
: 0px; letter-spacing: normal; font-family: "Arial","Helveti=
ca",sans-serif; font-size: 13px; font-variant: normal; word-spacing: 0=
px; display: inline !important; white-space: normal; orphans: 2; float: non=
e; -webkit-text-stroke-width: 0px; background-color: transparent;"><br></sp=
an></div><div><span style=3D"text-align: left; color: rgb(34, 34, 34); text=
-transform: none; text-indent: 0px; letter-spacing: normal; font-family: &q=
uot;Arial","Helvetica",sans-serif; font-size: 13px; font-var=
iant: normal; word-spacing: 0px; display: inline !important; white-space: n=
ormal; orphans: 2; float: none; -webkit-text-stroke-width: 0px; background-=
color: transparent;">Colon just happens to be the best one.</span></div><di=
v><span style=3D"text-align: left; color: rgb(34, 34, 34); text-transform: =
none; text-indent: 0px; letter-spacing: normal; font-family: "Arial&qu=
ot;,"Helvetica",sans-serif; font-size: 13px; font-variant: normal=
; word-spacing: 0px; display: inline !important; white-space: normal; orpha=
ns: 2; float: none; -webkit-text-stroke-width: 0px; background-color: trans=
parent;"><br></span></div><div><span style=3D"text-align: left; color: rgb(=
34, 34, 34); text-transform: none; text-indent: 0px; letter-spacing: normal=
; font-family: "Arial","Helvetica",sans-serif; font-siz=
e: 13px; font-variant: normal; word-spacing: 0px; display: inline !importan=
t; white-space: normal; orphans: 2; float: none; -webkit-text-stroke-width:=
0px; background-color: transparent;">If we <i>don't</i> use colon, we =
are selling ourselfs short=C2=A0 -=C2=A0 we lose named constructors altoget=
her.=C2=A0</span></div><div><span style=3D"text-align: left; color: rgb(34,=
34, 34); text-transform: none; text-indent: 0px; letter-spacing: normal; f=
ont-family: "Arial","Helvetica",sans-serif; font-size: =
13px; font-variant: normal; word-spacing: 0px; display: inline !important; =
white-space: normal; orphans: 2; float: none; -webkit-text-stroke-width: 0p=
x; background-color: transparent;">People will continue to use <font face=
=3D"courier new,monospace">rect::from_center({12,12})</font></span></div><d=
iv>And we both know that is far, far from ideal</div><div><br></div><div>An=
d BTW <font face=3D"courier new,monospace">rect(center: center); </font><fo=
nt face=3D"arial,sans-serif">also "just works". How cool is that.=
</font></div><div><font face=3D"arial,sans-serif"><br></font></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=
></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"l=
tr"><div></div><font face=3D"courier new,monospace">QString(number, 100)</f=
ont><div><font face=3D"courier new,monospace"></font><br></div><div><font f=
ace=3D"arial,sans-serif">Hum...</font></div><div><font face=3D"courier new,=
monospace"></font><br></div><div><font face=3D"courier new,monospace">image=
(data, buffer, 12)</font></div><div><font face=3D"courier new,monospace"><s=
pan style=3D"display:inline!important;float:none;background-color:transpare=
nt;color:rgb(34,34,34);font-family:courier new,monospace;font-size:13px;fon=
t-style:normal;font-variant:normal;font-weight:400;letter-spacing:normal;te=
xt-align:left;text-decoration:none;text-indent:0px;text-transform:none;whit=
e-space:normal;word-spacing:0px">image(clone, background)</span><b></b><i><=
/i><u></u><sub></sub><sup></sup><strike></strike></font></div><div><font fa=
ce=3D"courier new,monospace"><br></font></div><div><font face=3D"courier ne=
w,monospace"><span style=3D"display:inline!important;float:none;background-=
color:transparent;color:rgb(34,34,34);font-family:arial,sans-serif;font-siz=
e:13px;font-style:normal;font-variant:normal;font-weight:400;letter-spacing=
:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform=
:none;white-space:normal;word-spacing:0px">Hum, hum...</span></font></div><=
/div></blockquote><div><br></div><div>I don't see how adding a colon im=
proves any of these cases. Without context, I have no idea what any of thes=
e functions or constructors or whatever are doing.<br></div><div><br></div>=
<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;borde=
r-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div><font face=3D=
"courier new,monospace"><span style=3D"display:inline!important;float:none;=
background-color:transparent;color:rgb(34,34,34);font-family:arial,sans-ser=
if;font-size:13px;font-style:normal;font-variant:normal;font-weight:400;let=
ter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;tex=
t-transform:none;white-space:normal;word-spacing:0px"></span></font></div><=
div><span style=3D"text-align:left;color:rgb(34,34,34);text-transform:none;=
text-indent:0px;letter-spacing:normal;font-size:13px;font-style:normal;font=
-variant:normal;font-weight:400;text-decoration:none;word-spacing:0px;displ=
ay:inline!important;white-space:normal;float:none;background-color:transpar=
ent"><font face=3D"courier new,monospace">write(commit, package)</font></sp=
an></div><div><font face=3D"courier new,monospace"><br></font></div><div><f=
ont face=3D"arial,sans-serif">The point is - if we take away the sematic di=
sambiguation ("a note" vs "a list item") we inflict <i>=
massive</i> damage. Some interfaces become <i>impossible,</i> not technical=
ly, but practically.</font></div><div><font face=3D"arial,sans-serif"><br><=
/font></div><div><font face=3D"arial,sans-serif">In that sense, <i>the colo=
n alone</i> is enabling technology, much like "separate variables"=
; in structured bindings.</font></div></div></blockquote><div><br></div><di=
v>I fail to see that. `rect(center: {12, 12})` <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><font face=3D"=
arial,sans-serif"></font></div><div><font face=3D"arial,sans-serif">Separat=
e variables give us "multiple return types", a colon gives us &qu=
ot;named constructors" (and more).</font></div></div></blockquote><div=
><br></div></div></blockquote><div>=C2=A0</div><blockquote class=3D"gmail_q=
uote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;pad=
ding-left: 1ex;"><div dir=3D"ltr"><div></div><div>The problem I have with t=
his analogy is simply the relative cost of the two constructs. `get<>=
` is huge, bulky, annoying, and has to be done every time you access the me=
mber of an MRV function that returned a tuple.</div><div><br></div><div>A c=
omma is none of that. Structured binding purchases its place in C++ by taki=
ng huge, complex, and ugly syntax and making it big. Yours takes `rect(cent=
er, {12, 12})` and turns it into `rect(center: {12, 12})`.</div><div><br></=
div><div>There's no comparison; structured binding solves a much bigger=
problem than your syntax. Your syntax is purely a rotational improvement. =
And that's if we accept the premise that it's an improvement.<br></=
div></div></blockquote><div><br></div><div>Yet, structured bindings are not=
enabling technology, but this, if done right, is. It is not about the numb=
er of chars - its about new ways to express an interface.</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/c433a80b-953d-4bbe-a12f-0ec8b461c63d%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/c433a80b-953d-4bbe-a12f-0ec8b461c63d=
%40isocpp.org</a>.<br />
------=_Part_64027_1761069942.1531381414473--
------=_Part_64026_1778655015.1531381414471--
.
Author: mihailnajdenov@gmail.com
Date: Thu, 19 Jul 2018 08:53:04 -0700 (PDT)
Raw View
------=_Part_3773_750380822.1532015584965
Content-Type: multipart/alternative;
boundary="----=_Part_3774_1548253198.1532015584965"
------=_Part_3774_1548253198.1532015584965
Content-Type: text/plain; charset="UTF-8"
continuation at:
https://groups.google.com/a/isocpp.org/d/msg/std-proposals/tPtdQE2GXb0/4OjT5Z4pBQAJ
>
--
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/b5d0701e-a758-433e-9adf-67fbf0d5e39e%40isocpp.org.
------=_Part_3774_1548253198.1532015584965
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">continuation at: https://groups.google.com/a/isocpp.org/d/=
msg/std-proposals/tPtdQE2GXb0/4OjT5Z4pBQAJ=C2=A0<br><blockquote class=3D"gm=
ail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc soli=
d;padding-left: 1ex;"><div dir=3D"ltr"><div></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/b5d0701e-a758-433e-9adf-67fbf0d5e39e%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/b5d0701e-a758-433e-9adf-67fbf0d5e39e=
%40isocpp.org</a>.<br />
------=_Part_3774_1548253198.1532015584965--
------=_Part_3773_750380822.1532015584965--
.