Topic: explicit member variables


Author: ma.kalbfuss@web.de
Date: Wed, 30 Mar 2016 13:31:07 -0700 (PDT)
Raw View
------=_Part_782_2007007381.1459369867445
Content-Type: multipart/alternative;
 boundary="----=_Part_783_308785396.1459369867445"

------=_Part_783_308785396.1459369867445
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Hi Community,

I had an idea about explicit member variables. Explicit means, that they=20
have to be explicitly passed as parameters to the default constructor.

class Person
{
    explicit string first_name;    // explicit
    explicit string last_name;     // explicit
    explicit unsigned age =3D 0;     // optional with default value
    TelNum tel_num;                // implicit
};

This will generate a default constructor of the form

Person::Person(string first_name, string last_name, unsigned age =3D 0);

What do you think?

Best Regards

Martin Kalbfu=C3=9F

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/a03295e3-57f6-4f72-8f6a-3b4d1f2c7e90%40isocpp.or=
g.

------=_Part_783_308785396.1459369867445
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi Community,<br><br>I had an idea about explicit member v=
ariables. Explicit means, that they have to be explicitly passed as paramet=
ers to the default constructor.<br><br><div class=3D"prettyprint" style=3D"=
background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); bor=
der-style: solid; border-width: 1px; word-wrap: break-word;"><code class=3D=
"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">class</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=3D"style=
d-by-prettify">Person</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"><br></span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-pretti=
fy">explicit</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">string<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> first_name=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0</spa=
n><span style=3D"color: #800;" class=3D"styled-by-prettify">// explicit</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=
=A0 </span><span style=3D"color: #008;" class=3D"styled-by-prettify">explic=
it</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span>=
<span style=3D"color: #008;" class=3D"styled-by-prettify">string</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> last_name</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0 </span><span =
style=3D"color: #800;" class=3D"styled-by-prettify">// explicit</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </sp=
an><span style=3D"color: #008;" class=3D"styled-by-prettify">explicit</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">unsigned</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> age </span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #066;" cl=
ass=3D"styled-by-prettify">0</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> =C2=A0 =C2=A0 </span><span style=3D"color: #800;" class=3D"styled=
-by-prettify">// optional with default value</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"c=
olor: #606;" class=3D"styled-by-prettify">TelNum</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> tel_num</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0</span><span style=3D"color: #800;" class=3D"styled-by-prettify">=
// implicit</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
><br></span><span style=3D"color: #660;" class=3D"styled-by-prettify">};</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span></=
div></code></div><br>This will generate a default constructor of the form<b=
r><br><div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 2=
50); border-color: rgb(187, 187, 187); border-style: solid; border-width: 1=
px; word-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subpr=
ettyprint"><span style=3D"color: #606;" class=3D"styled-by-prettify">Person=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><=
span style=3D"color: #606;" class=3D"styled-by-prettify">Person</span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D=
"color: #008;" class=3D"styled-by-prettify">string</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> first_name</span><span style=3D"co=
lor: #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">string</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> last_name</span><span 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=
">unsigned</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
 age </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><spa=
n style=3D"color: #066;" class=3D"styled-by-prettify">0</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">);</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"><br></span></div></code></div><br>Wh=
at do you think?<br><br>Best Regards<br><br>Martin Kalbfu=C3=9F<br></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/a03295e3-57f6-4f72-8f6a-3b4d1f2c7e90%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/a03295e3-57f6-4f72-8f6a-3b4d1f2c7e90=
%40isocpp.org</a>.<br />

------=_Part_783_308785396.1459369867445--
------=_Part_782_2007007381.1459369867445--

.


Author: ma.kalbfuss@web.de
Date: Wed, 30 Mar 2016 14:42:24 -0700 (PDT)
Raw View
------=_Part_7222_990777842.1459374144366
Content-Type: multipart/alternative;
 boundary="----=_Part_7223_762380314.1459374144367"

------=_Part_7223_762380314.1459374144367
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Some reasoning. The point of this is to reduce repetition of the variable=
=20
names. Currently you have to write

class Person
{

public:

    Person(string first_name, string last_name, unsigned age =3D 0)
        : first_name{ first_name }
        , last_name{ last_name }
        , age{ age }
    { }

private:

    string first_name;
    string last_name;
    unsigned age;
    TelNum tel_num;
   =20

};

You have to repeat each member name additional 3 times. That's a lot of=20
redundancy for such a simple task.


Am Mittwoch, 30. M=C3=A4rz 2016 22:31:07 UTC+2 schrieb ma.ka...@web.de:
>
> Hi Community,
>
> I had an idea about explicit member variables. Explicit means, that they=
=20
> have to be explicitly passed as parameters to the default constructor.
>
> class Person
> {
>     explicit string first_name;    // explicit
>     explicit string last_name;     // explicit
>     explicit unsigned age =3D 0;     // optional with default value
>     TelNum tel_num;                // implicit
> };
>
> This will generate a default constructor of the form
>
> Person::Person(string first_name, string last_name, unsigned age =3D 0);
>
> What do you think?
>
> Best Regards
>
> Martin Kalbfu=C3=9F
>

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/78f215f5-a176-43be-b428-561fd5dfb0f8%40isocpp.or=
g.

------=_Part_7223_762380314.1459374144367
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Some reasoning. The point of this is to reduce repetition =
of the variable names. Currently you have to write<br><br><div class=3D"pre=
ttyprint" style=3D"background-color: rgb(250, 250, 250); border-color: rgb(=
187, 187, 187); border-style: solid; border-width: 1px; word-wrap: break-wo=
rd;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=
=3D"color: #008;" class=3D"styled-by-prettify">class</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #60=
6;" class=3D"styled-by-prettify">Person</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br><br></span><span style=3D"color: #008;" class=3D"styled-=
by-prettify">public</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">:</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
<br><br>=C2=A0 =C2=A0 </span><span style=3D"color: #606;" class=3D"styled-b=
y-prettify">Person</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">(</span><span style=3D"color: #008;" class=3D"styled-by-prettify">s=
tring</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> firs=
t_name</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span=
 style=3D"color: #008;" class=3D"styled-by-prettify">string</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> last_name</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;=
" class=3D"styled-by-prettify">unsigned</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> age </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-pr=
ettify">0</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0=
 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">:</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> first_name</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> firs=
t_name </span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> last_name</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> last_n=
ame </span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
age</span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> age </span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><sp=
an 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=
: #660;" class=3D"styled-by-prettify">}</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"><br><br></span><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">private</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">:</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br><br></span><code><span style=3D"color:#000"><span style=
=3D"color: #000;" class=3D"styled-by-prettify">=C2=A0 =C2=A0 </span></span>=
<span style=3D"color:#000"></span><span style=3D"color:#008"><span style=3D=
"color: #008;" class=3D"styled-by-prettify">string</span></span><span style=
=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
first_name</span></span><span style=3D"color:#660"><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">;</span></span><span style=3D"color:#000"=
><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span></spa=
n><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-b=
y-prettify">=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styl=
ed-by-prettify">string</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> last_name</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"><br>=C2=A0 =C2=A0 </span></span><span style=3D"color:#008"><span style=
=3D"color: #008;" class=3D"styled-by-prettify">unsigned</span></span><span =
style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> age</span></span><span style=3D"color:#066"></span><span style=3D"colo=
r:#660"><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><=
/span><span style=3D"color:#000"></span><span style=3D"color:#000"><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span>=
</span><span style=3D"color:#606"><span style=3D"color: #606;" class=3D"sty=
led-by-prettify">TelNum</span></span><span style=3D"color:#000"><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> tel_num</span></span><span =
style=3D"color:#660"><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">;</span></span><span style=3D"color:#000"></span><span style=3D"color:#=
000"><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><=
/span></code><span style=3D"color: #000;" class=3D"styled-by-prettify">=C2=
=A0 =C2=A0 <br><br></span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">};</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
><br></span></div></code></div><br>You have to repeat each member name addi=
tional 3 times. That&#39;s a lot of redundancy for such a simple task.<br><=
br><br>Am Mittwoch, 30. M=C3=A4rz 2016 22:31:07 UTC+2 schrieb ma.ka...@web.=
de:<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">Hi Communi=
ty,<br><br>I had an idea about explicit member variables. Explicit means, t=
hat they have to be explicitly passed as parameters to the default construc=
tor.<br><br><div style=3D"background-color:rgb(250,250,250);border-color:rg=
b(187,187,187);border-style:solid;border-width:1px;word-wrap:break-word"><c=
ode><div><span style=3D"color:#008">class</span><span style=3D"color:#000">=
 </span><span style=3D"color:#606">Person</span><span style=3D"color:#000">=
<br></span><span style=3D"color:#660">{</span><span style=3D"color:#000"><b=
r>=C2=A0 =C2=A0 </span><span style=3D"color:#008">explicit</span><span styl=
e=3D"color:#000"> </span><span style=3D"color:#008">string</span><span styl=
e=3D"color:#000"> first_name</span><span style=3D"color:#660">;</span><span=
 style=3D"color:#000"> =C2=A0 =C2=A0</span><span style=3D"color:#800">// ex=
plicit</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span styl=
e=3D"color:#008">explicit</span><span style=3D"color:#000"> </span><span st=
yle=3D"color:#008">string</span><span style=3D"color:#000"> last_name</span=
><span style=3D"color:#660">;</span><span style=3D"color:#000"> =C2=A0 =C2=
=A0 </span><span style=3D"color:#800">// explicit</span><span style=3D"colo=
r:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#008">explicit</span>=
<span style=3D"color:#000"> </span><span style=3D"color:#008">unsigned</spa=
n><span style=3D"color:#000"> age </span><span style=3D"color:#660">=3D</sp=
an><span style=3D"color:#000"> </span><span style=3D"color:#066">0</span><s=
pan style=3D"color:#660">;</span><span style=3D"color:#000"> =C2=A0 =C2=A0 =
</span><span style=3D"color:#800">// optional with default value</span><spa=
n style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#606">=
TelNum</span><span style=3D"color:#000"> tel_num</span><span style=3D"color=
:#660">;</span><span style=3D"color:#000"> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0</span><span style=3D"color:#800">// implicit</span=
><span style=3D"color:#000"><br></span><span style=3D"color:#660">};</span>=
<span style=3D"color:#000"><br></span></div></code></div><br>This will gene=
rate a default constructor of the form<br><br><div style=3D"background-colo=
r:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-=
width:1px;word-wrap:break-word"><code><div><span style=3D"color:#606">Perso=
n</span><span style=3D"color:#660">::</span><span style=3D"color:#606">Pers=
on</span><span style=3D"color:#660">(</span><span style=3D"color:#008">stri=
ng</span><span style=3D"color:#000"> first_name</span><span style=3D"color:=
#660">,</span><span style=3D"color:#000"> </span><span style=3D"color:#008"=
>string</span><span style=3D"color:#000"> last_name</span><span style=3D"co=
lor:#660">,</span><span style=3D"color:#000"> </span><span style=3D"color:#=
008">unsigned</span><span style=3D"color:#000"> age </span><span style=3D"c=
olor:#660">=3D</span><span style=3D"color:#000"> </span><span style=3D"colo=
r:#066">0</span><span style=3D"color:#660">);</span><span style=3D"color:#0=
00"><br></span></div></code></div><br>What do you think?<br><br>Best Regard=
s<br><br>Martin Kalbfu=C3=9F<br></div></blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/78f215f5-a176-43be-b428-561fd5dfb0f8%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/78f215f5-a176-43be-b428-561fd5dfb0f8=
%40isocpp.org</a>.<br />

------=_Part_7223_762380314.1459374144367--
------=_Part_7222_990777842.1459374144366--

.


Author: Arthur O'Dwyer <arthur.j.odwyer@gmail.com>
Date: Wed, 30 Mar 2016 16:20:53 -0700 (PDT)
Raw View
------=_Part_89_30548589.1459380053699
Content-Type: multipart/alternative;
 boundary="----=_Part_90_696981373.1459380053700"

------=_Part_90_696981373.1459380053700
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Wednesday, March 30, 2016 at 1:31:07 PM UTC-7, ma.ka...@web.de wrote:
>
>
> I had an idea about explicit member variables. Explicit means, that they=
=20
> have to be explicitly passed as parameters to the default constructor.
>
> class Person
> {
>     explicit string first_name;    // explicit
>     explicit string last_name;     // explicit
>     explicit unsigned age =3D 0;     // optional with default value
>     TelNum tel_num;                // implicit
> };
>
> This will generate a default constructor of the form
>
> Person::Person(string first_name, string last_name, unsigned age =3D 0);
>
> What do you think?
>

I think
(A) That's not what "explicit" means anywhere else in the language right=20
now, so I don't see why "explicit" is the right keyword. A much more=20
logical syntax given the existing language would be

class Person
{
    string first_name;
    string last_name;
    unsigned age;
    TelNum tel_num;
  public:
    Person(string first_name, string last_name, unsigned age =3D 0) =3D def=
ault;
};

but notice that IMO this would never pass muster with the Committee,=20
because it introduces a spooky interaction between the *spelling* of the=20
first_name parameter to Person::Person and the *spelling* of the=20
Person::first_name data member. Everywhere in the current language,=20
parameter names "don't matter"; you can even omit them if you want. Having=
=20
their *spelling* suddenly affect the code's *semantics* would be a huge=20
deal, break refactoring tools across the board, and just generally... yuck.

(B) This idea is closely related (in my head at least) to proposals for=20
supporting C99 designated initializer syntax in C++ and possibly for=20
supporting named parameters (kwargs). You should look up some previous=20
discussions of "designated initializers" in this group and see what people=
=20
have said about them in the past. Yeah, it's not *quite* the same thing,=20
but I see it as closely related.

(C) JetBrains' CLion IDE definitely has a keyboard shortcut to plop out all=
=20
that boilerplate for you, and I bet there are similar plugins for other=20
IDEs. If you're spending a significant amount of coding time on typing out=
=20
these constructs, you ought to either change the kind of code you're=20
writing (e.g., learn to love struct, or possibly switch jobs ;)), or get an=
=20
IDE that supports quickly writing these constructs.

I don't think the language should change to support writing this kind of=20
code more efficiently; where "this kind of code" is code that uses
- lots of classes
- with public constructors
- taking parameters that are moved blindly into the non-static data members=
=20
of the class object under construction
- (no checking of invariants, no non-trivial initialization logic)
- and where those non-static data members are non-public, or else=20
brace-initialization would solve the problem already.

Finally, (D), a relatively trivial standardese nitpick: You don't provide=
=20
any way to specify the public/private/protectedness of the generated=20
constructor. My alternative syntax in (A) would solve that nitpick... but=
=20
to be clear, I don't like my alternative syntax either. IMO this proposal=
=20
just doesn't solve a problem that a lot of people have in C++ today.

=E2=80=93Arthur

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/a540e487-f70a-46b4-8731-3156753692f0%40isocpp.or=
g.

------=_Part_90_696981373.1459380053700
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Wednesday, March 30, 2016 at 1:31:07 PM UTC-7, ma.ka...=
@web.de 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"=
><br>I had an idea about explicit member variables. Explicit means, that th=
ey have to be explicitly passed as parameters to the default constructor.<b=
r><br><div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,=
187,187);border-style:solid;border-width:1px;word-wrap:break-word"><code><d=
iv><span style=3D"color:#008">class</span><span style=3D"color:#000"> </spa=
n><span style=3D"color:#606">Person</span><span style=3D"color:#000"><br></=
span><span style=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=
=A0 =C2=A0 </span><span style=3D"color:#008">explicit</span><span style=3D"=
color:#000"> </span><span style=3D"color:#008">string</span><span style=3D"=
color:#000"> first_name</span><span style=3D"color:#660">;</span><span styl=
e=3D"color:#000"> =C2=A0 =C2=A0</span><span style=3D"color:#800">// explici=
t</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"=
color:#008">explicit</span><span style=3D"color:#000"> </span><span style=
=3D"color:#008">string</span><span style=3D"color:#000"> last_name</span><s=
pan style=3D"color:#660">;</span><span style=3D"color:#000"> =C2=A0 =C2=A0 =
</span><span style=3D"color:#800">// explicit</span><span style=3D"color:#0=
00"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#008">explicit</span><spa=
n style=3D"color:#000"> </span><span style=3D"color:#008">unsigned</span><s=
pan style=3D"color:#000"> age </span><span style=3D"color:#660">=3D</span><=
span style=3D"color:#000"> </span><span style=3D"color:#066">0</span><span =
style=3D"color:#660">;</span><span style=3D"color:#000"> =C2=A0 =C2=A0 </sp=
an><span style=3D"color:#800">// optional with default value</span><span st=
yle=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#606">TelN=
um</span><span style=3D"color:#000"> tel_num</span><span style=3D"color:#66=
0">;</span><span style=3D"color:#000"> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0</span><span style=3D"color:#800">// implicit</span><sp=
an style=3D"color:#000"><br></span><span style=3D"color:#660">};</span><spa=
n style=3D"color:#000"><br></span></div></code></div><br>This will generate=
 a default constructor of the form<br><br><div style=3D"background-color:rg=
b(250,250,250);border-color:rgb(187,187,187);border-style:solid;border-widt=
h:1px;word-wrap:break-word"><code><div><span style=3D"color:#606">Person</s=
pan><span style=3D"color:#660">::</span><span style=3D"color:#606">Person</=
span><span style=3D"color:#660">(</span><span style=3D"color:#008">string</=
span><span style=3D"color:#000"> first_name</span><span style=3D"color:#660=
">,</span><span style=3D"color:#000"> </span><span style=3D"color:#008">str=
ing</span><span style=3D"color:#000"> last_name</span><span style=3D"color:=
#660">,</span><span style=3D"color:#000"> </span><span style=3D"color:#008"=
>unsigned</span><span style=3D"color:#000"> age </span><span style=3D"color=
:#660">=3D</span><span style=3D"color:#000"> </span><span style=3D"color:#0=
66">0</span><span style=3D"color:#660">);</span><span style=3D"color:#000">=
<br></span></div></code></div><br>What do you think?<br></div></blockquote>=
<div><br></div><div>I think</div><div>(A) That&#39;s not what &quot;explici=
t&quot; means anywhere else in the language right now, so I don&#39;t see w=
hy &quot;explicit&quot; is the right keyword. A much more logical syntax gi=
ven the existing language would be</div><div><br></div><div class=3D"pretty=
print" style=3D"background-color: rgb(250, 250, 250); border: 1px solid rgb=
(187, 187, 187); word-wrap: break-word;"><code class=3D"prettyprint"><div c=
lass=3D"subprettyprint"><span style=3D"color: #008;" class=3D"styled-by-pre=
ttify">class</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">Person<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><=
span style=3D"color: #008;" class=3D"styled-by-prettify">string</span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> first_name</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">string</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> last_name</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">unsigned</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> age</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"co=
lor: #606;" class=3D"styled-by-prettify">TelNum</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> tel_num</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br>=C2=A0 </span><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">public</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">:</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #606;" class=
=3D"styled-by-prettify">Person</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">(</span><span style=3D"color: #008;" class=3D"styled-by=
-prettify">string</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> first_name</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">string</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> last_name</sp=
an><span 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">unsigned</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> age </span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> </span><span style=3D"color: #066;" class=3D"=
styled-by-prettify">0</span><span 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: #660;" class=3D"styled-by-prettify">=3D</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span =
style=3D"color: #008;" class=3D"styled-by-prettify">default</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">};</span></div></code></div><div><br></di=
v><div>but notice that IMO this would never pass muster with the Committee,=
 because it introduces a spooky interaction between the <i>spelling</i> of =
the <font face=3D"courier new, monospace">first_name</font> parameter to <f=
ont face=3D"courier new, monospace">Person::Person</font> and the <i>spelli=
ng</i>=C2=A0of the <font face=3D"courier new, monospace">Person::first_name=
</font> data member. Everywhere in the current language, parameter names &q=
uot;don&#39;t matter&quot;; you can even omit them if you want. Having thei=
r <i>spelling</i> suddenly affect the code&#39;s=C2=A0<i>semantics</i> woul=
d be a huge deal, break refactoring tools across the board, and just genera=
lly... yuck.</div><div><br></div><div>(B) This idea is closely related (in =
my head at least) to proposals for supporting C99 designated initializer sy=
ntax in C++ and possibly for supporting named parameters (kwargs). You shou=
ld look up some previous discussions of &quot;designated initializers&quot;=
 in this group and see what people have said about them in the past. Yeah, =
it&#39;s not <i>quite</i> the same thing, but I see it as closely related.<=
/div><div><br></div><div>(C) JetBrains&#39; CLion IDE definitely has a keyb=
oard shortcut to plop out all that boilerplate for you, and I bet there are=
 similar plugins for other IDEs. If you&#39;re spending a significant amoun=
t of coding time on typing out these constructs, you ought to either change=
 the kind of code you&#39;re writing (e.g., learn to love <font face=3D"cou=
rier new, monospace">struct</font>, or possibly switch jobs ;)), or get an =
IDE that supports quickly writing these constructs.</div><div><br></div><di=
v>I don&#39;t think the language should change to support writing this kind=
 of code more efficiently; where &quot;this kind of code&quot; is code that=
 uses</div><div>- lots of classes</div><div>- with public constructors</div=
><div>- taking parameters that are moved blindly into the non-static data m=
embers of the class object under construction</div><div>- (no checking of i=
nvariants, no non-trivial initialization logic)</div><div>- and where those=
 non-static data members are non-public, or else brace-initialization would=
 solve the problem already.</div><div><br></div><div>Finally, (D), a relati=
vely trivial standardese nitpick: You don&#39;t provide any way to specify =
the public/private/protectedness of the generated constructor. My alternati=
ve syntax in (A) would solve that nitpick... but to be clear, I don&#39;t l=
ike my alternative syntax either. IMO this proposal just doesn&#39;t solve =
a problem that a lot of people have in C++ today.</div><div><br></div><div>=
=E2=80=93Arthur</div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/a540e487-f70a-46b4-8731-3156753692f0%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/a540e487-f70a-46b4-8731-3156753692f0=
%40isocpp.org</a>.<br />

------=_Part_90_696981373.1459380053700--
------=_Part_89_30548589.1459380053699--

.


Author: ma.kalbfuss@web.de
Date: Thu, 31 Mar 2016 01:27:08 -0700 (PDT)
Raw View
------=_Part_38_527963648.1459412828251
Content-Type: multipart/alternative;
 boundary="----=_Part_39_2064981053.1459412828252"

------=_Part_39_2064981053.1459412828252
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

The use of the name explicit was only a first suggestion. I would be=20
perfectly fine with another name. The naming is not the point here.
The default constructor is public by default as it always was. If you like=
=20
to provide a private or protected default constructor you have to still=20
explicitly state this.


Best Regards

Martin


class Person
{

public:

    Person(string first_name, string last_name, unsigned age =3D 0) =3D def=
ault;

    explicit string first_name;    // explicit
    explicit string last_name;     // explicit
    explicit unsigned age =3D 0;     // optional with default value
    TelNum tel_num;                // implicit
};

1: "lots of classes". If I have a lot of code, it's likely that I have a=20
lot of classes, too. I don't get your point. Is your argument to favor a=20
functional style?
2: "with public constructors". The default constructor is already public.=
=20
That's not part of my idea.
3: "taking parameters that are moved blindly into the non-static data=20
members of the class object under construction". But It isn't blindly. You=
=20
explicitly state it.
4: "(no checking of invariants, no non-trivial initialization logic)". This=
=20
is about the default constructor. It should handle default cases.=20
Implementation of complex initialization logic is the job of the=20
programmer. The compiler cannot handle such things well.


Am Donnerstag, 31. M=C3=A4rz 2016 01:20:53 UTC+2 schrieb Arthur O'Dwyer:
>
> On Wednesday, March 30, 2016 at 1:31:07 PM UTC-7, ma.ka...@web.de wrote:
>>
>>
>> I had an idea about explicit member variables. Explicit means, that they=
=20
>> have to be explicitly passed as parameters to the default constructor.
>>
>> class Person
>> {
>>     explicit string first_name;    // explicit
>>     explicit string last_name;     // explicit
>>     explicit unsigned age =3D 0;     // optional with default value
>>     TelNum tel_num;                // implicit
>> };
>>
>> This will generate a default constructor of the form
>>
>> Person::Person(string first_name, string last_name, unsigned age =3D 0);
>>
>> What do you think?
>>
>
> I think
> (A) That's not what "explicit" means anywhere else in the language right=
=20
> now, so I don't see why "explicit" is the right keyword. A much more=20
> logical syntax given the existing language would be
>
> class Person
> {
>     string first_name;
>     string last_name;
>     unsigned age;
>     TelNum tel_num;
>   public:
>     Person(string first_name, string last_name, unsigned age =3D 0) =3D=
=20
> default;
> };
>
> but notice that IMO this would never pass muster with the Committee,=20
> because it introduces a spooky interaction between the *spelling* of the=
=20
> first_name parameter to Person::Person and the *spelling* of the=20
> Person::first_name data member. Everywhere in the current language,=20
> parameter names "don't matter"; you can even omit them if you want. Havin=
g=20
> their *spelling* suddenly affect the code's *semantics* would be a huge=
=20
> deal, break refactoring tools across the board, and just generally... yuc=
k.
>
> (B) This idea is closely related (in my head at least) to proposals for=
=20
> supporting C99 designated initializer syntax in C++ and possibly for=20
> supporting named parameters (kwargs). You should look up some previous=20
> discussions of "designated initializers" in this group and see what peopl=
e=20
> have said about them in the past. Yeah, it's not *quite* the same thing,=
=20
> but I see it as closely related.
>
> (C) JetBrains' CLion IDE definitely has a keyboard shortcut to plop out=
=20
> all that boilerplate for you, and I bet there are similar plugins for oth=
er=20
> IDEs. If you're spending a significant amount of coding time on typing ou=
t=20
> these constructs, you ought to either change the kind of code you're=20
> writing (e.g., learn to love struct, or possibly switch jobs ;)), or get=
=20
> an IDE that supports quickly writing these constructs.
>
> I don't think the language should change to support writing this kind of=
=20
> code more efficiently; where "this kind of code" is code that uses
> - lots of classes
> - with public constructors
> - taking parameters that are moved blindly into the non-static data=20
> members of the class object under construction
> - (no checking of invariants, no non-trivial initialization logic)
> - and where those non-static data members are non-public, or else=20
> brace-initialization would solve the problem already.
>
> Finally, (D), a relatively trivial standardese nitpick: You don't provide=
=20
> any way to specify the public/private/protectedness of the generated=20
> constructor. My alternative syntax in (A) would solve that nitpick... but=
=20
> to be clear, I don't like my alternative syntax either. IMO this proposal=
=20
> just doesn't solve a problem that a lot of people have in C++ today.
>
> =E2=80=93Arthur
>

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/303348b5-48db-4a48-bcf9-2bf816950518%40isocpp.or=
g.

------=_Part_39_2064981053.1459412828252
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">The use of the name explicit was only a first suggestion. =
I would be perfectly fine with another name. The naming is not the point he=
re.<br>The default constructor is public by default as it always was. If yo=
u like to provide a private or protected default constructor you have to st=
ill explicitly state this.<br><br><br>Best Regards<br><br>Martin<br><br><br=
><div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); =
border-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; w=
ord-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subprettyp=
rint"><div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,=
187,187);border-style:solid;border-width:1px;word-wrap:break-word"><code><d=
iv><span style=3D"color:#008"><span style=3D"color: #008;" class=3D"styled-=
by-prettify">class</span></span><span style=3D"color:#000"><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span></span><span style=3D"col=
or:#606"><span style=3D"color: #606;" class=3D"styled-by-prettify">Person</=
span></span><span style=3D"color:#000"><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br></span></span><span style=3D"color:#660"><span =
style=3D"color: #660;" class=3D"styled-by-prettify">{</span></span><span st=
yle=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify=
"><br><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">=
public</span><span style=3D"color: #660;" class=3D"styled-by-prettify">:</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span></=
span><br><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"><code class=3D"prettyprint"><code><span style=3D"color:#=
000"><span style=3D"color: #606;" class=3D"styled-by-prettify">=C2=A0=C2=A0=
=C2=A0 Person</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">(</span><span style=3D"color: #008;" class=3D"styled-by-prettify">string=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> first_nam=
e</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span styl=
e=3D"color: #008;" class=3D"styled-by-prettify">string</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> last_name</span><span 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;" cla=
ss=3D"styled-by-prettify">unsigned</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> age </span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-prettif=
y">0</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #=
008;" class=3D"styled-by-prettify">default</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br></span></span></code></code><br>=C2=A0 =C2=A0 <=
/span></span><span style=3D"color:#008"><span style=3D"color: #008;" class=
=3D"styled-by-prettify">explicit</span></span><span style=3D"color:#000"><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> </span></span><spa=
n style=3D"color:#008"><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">string</span></span><span style=3D"color:#000"><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> first_name</span></span><span style=3D=
"color:#660"><span style=3D"color: #660;" class=3D"styled-by-prettify">;</s=
pan></span><span style=3D"color:#000"><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> =C2=A0 =C2=A0</span></span><span style=3D"color:#800"=
><span style=3D"color: #800;" class=3D"styled-by-prettify">// explicit</spa=
n></span><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"><br>=C2=A0 =C2=A0 </span></span><span style=3D"color:#00=
8"><span style=3D"color: #008;" class=3D"styled-by-prettify">explicit</span=
></span><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span></span><span style=3D"color:#008"><span style=3D"=
color: #008;" class=3D"styled-by-prettify">string</span></span><span style=
=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
last_name</span></span><span style=3D"color:#660"><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">;</span></span><span style=3D"color:#000">=
<span style=3D"color: #000;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0 </=
span></span><span style=3D"color:#800"><span style=3D"color: #800;" class=
=3D"styled-by-prettify">// explicit</span></span><span style=3D"color:#000"=
><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=
=A0 </span></span><span style=3D"color:#008"><span style=3D"color: #008;" c=
lass=3D"styled-by-prettify">explicit</span></span><span style=3D"color:#000=
"><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span></span>=
<span style=3D"color:#008"><span style=3D"color: #008;" class=3D"styled-by-=
prettify">unsigned</span></span><span style=3D"color:#000"><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> age </span></span><span style=3D=
"color:#660"><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D<=
/span></span><span style=3D"color:#000"><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span></span><span style=3D"color:#066"><span sty=
le=3D"color: #066;" class=3D"styled-by-prettify">0</span></span><span style=
=3D"color:#660"><span style=3D"color: #660;" class=3D"styled-by-prettify">;=
</span></span><span style=3D"color:#000"><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> =C2=A0 =C2=A0 </span></span><span style=3D"color:#=
800"><span style=3D"color: #800;" class=3D"styled-by-prettify">// optional =
with default value</span></span><span style=3D"color:#000"><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span></span><=
span style=3D"color:#606"><span style=3D"color: #606;" class=3D"styled-by-p=
rettify">TelNum</span></span><span style=3D"color:#000"><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> tel_num</span></span><span style=3D=
"color:#660"><span style=3D"color: #660;" class=3D"styled-by-prettify">;</s=
pan></span><span style=3D"color:#000"><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0</span></span><span style=3D"color:#800"><span style=3D"color: #800;" cl=
ass=3D"styled-by-prettify">// implicit</span></span><span style=3D"color:#0=
00"><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span></=
span><span style=3D"color:#660"><span style=3D"color: #660;" class=3D"style=
d-by-prettify">};</span></span><span style=3D"color:#000"><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br></span></span></div></code></d=
iv></div></code></div><br>1: &quot;lots of classes&quot;. If I have a lot o=
f code, it&#39;s likely that I have a lot of classes, too. I don&#39;t get =
your point. Is your argument to favor a functional style?<br>2: &quot;with =
public constructors&quot;. The default constructor is already public. That&=
#39;s not part of my idea.<br>3: &quot;taking parameters that are moved bli=
ndly into the non-static data members of the class object under constructio=
n&quot;. But It isn&#39;t blindly. You explicitly state it.<br>4: &quot;(no=
 checking of invariants, no non-trivial initialization logic)&quot;. This i=
s about the default constructor. It should handle default cases. Implementa=
tion of complex initialization logic is the job of the programmer. The comp=
iler cannot handle such things well.<br><br><br>Am Donnerstag, 31. M=C3=A4r=
z 2016 01:20:53 UTC+2 schrieb Arthur O&#39;Dwyer:<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">On Wednesday, March 30, 2016 at 1:31:07=
 PM UTC-7, <a>ma.ka...@web.de</a> wrote:<blockquote class=3D"gmail_quote" s=
tyle=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:=
1ex"><div dir=3D"ltr"><br>I had an idea about explicit member variables. Ex=
plicit means, that they have to be explicitly passed as parameters to the d=
efault constructor.<br><br><div style=3D"background-color:rgb(250,250,250);=
border-color:rgb(187,187,187);border-style:solid;border-width:1px;word-wrap=
:break-word"><code><div><span style=3D"color:#008">class</span><span style=
=3D"color:#000"> </span><span style=3D"color:#606">Person</span><span style=
=3D"color:#000"><br></span><span style=3D"color:#660">{</span><span style=
=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#008">explici=
t</span><span style=3D"color:#000"> </span><span style=3D"color:#008">strin=
g</span><span style=3D"color:#000"> first_name</span><span style=3D"color:#=
660">;</span><span style=3D"color:#000"> =C2=A0 =C2=A0</span><span style=3D=
"color:#800">// explicit</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0=
 </span><span style=3D"color:#008">explicit</span><span style=3D"color:#000=
"> </span><span style=3D"color:#008">string</span><span style=3D"color:#000=
"> last_name</span><span style=3D"color:#660">;</span><span style=3D"color:=
#000"> =C2=A0 =C2=A0 </span><span style=3D"color:#800">// explicit</span><s=
pan style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#008=
">explicit</span><span style=3D"color:#000"> </span><span style=3D"color:#0=
08">unsigned</span><span style=3D"color:#000"> age </span><span style=3D"co=
lor:#660">=3D</span><span style=3D"color:#000"> </span><span style=3D"color=
:#066">0</span><span style=3D"color:#660">;</span><span style=3D"color:#000=
"> =C2=A0 =C2=A0 </span><span style=3D"color:#800">// optional with default=
 value</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span styl=
e=3D"color:#606">TelNum</span><span style=3D"color:#000"> tel_num</span><sp=
an style=3D"color:#660">;</span><span style=3D"color:#000"> =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0</span><span style=3D"color:#800">=
// implicit</span><span style=3D"color:#000"><br></span><span style=3D"colo=
r:#660">};</span><span style=3D"color:#000"><br></span></div></code></div><=
br>This will generate a default constructor of the form<br><br><div style=
=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);border-=
style:solid;border-width:1px;word-wrap:break-word"><code><div><span style=
=3D"color:#606">Person</span><span style=3D"color:#660">::</span><span styl=
e=3D"color:#606">Person</span><span style=3D"color:#660">(</span><span styl=
e=3D"color:#008">string</span><span style=3D"color:#000"> first_name</span>=
<span style=3D"color:#660">,</span><span style=3D"color:#000"> </span><span=
 style=3D"color:#008">string</span><span style=3D"color:#000"> last_name</s=
pan><span style=3D"color:#660">,</span><span style=3D"color:#000"> </span><=
span style=3D"color:#008">unsigned</span><span style=3D"color:#000"> age </=
span><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> </spa=
n><span style=3D"color:#066">0</span><span style=3D"color:#660">);</span><s=
pan style=3D"color:#000"><br></span></div></code></div><br>What do you thin=
k?<br></div></blockquote><div><br></div><div>I think</div><div>(A) That&#39=
;s not what &quot;explicit&quot; means anywhere else in the language right =
now, so I don&#39;t see why &quot;explicit&quot; is the right keyword. A mu=
ch more logical syntax given the existing language would be</div><div><br><=
/div><div style=3D"background-color:rgb(250,250,250);border:1px solid rgb(1=
87,187,187);word-wrap:break-word"><code><div><span style=3D"color:#008">cla=
ss</span><span style=3D"color:#000"> </span><span style=3D"color:#606">Pers=
on</span><span style=3D"color:#000"><br></span><span style=3D"color:#660">{=
</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"c=
olor:#008">string</span><span style=3D"color:#000"> first_name</span><span =
style=3D"color:#660">;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 <=
/span><span style=3D"color:#008">string</span><span style=3D"color:#000"> l=
ast_name</span><span style=3D"color:#660">;</span><span style=3D"color:#000=
"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#008">unsigned</span><span =
style=3D"color:#000"> age</span><span style=3D"color:#660">;</span><span st=
yle=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#606">TelN=
um</span><span style=3D"color:#000"> tel_num</span><span style=3D"color:#66=
0">;</span><span style=3D"color:#000"><br>=C2=A0 </span><span style=3D"colo=
r:#008">public</span><span style=3D"color:#660">:</span><span style=3D"colo=
r:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#606">Person</span><s=
pan style=3D"color:#660">(</span><span style=3D"color:#008">string</span><s=
pan style=3D"color:#000"> first_name</span><span style=3D"color:#660">,</sp=
an><span style=3D"color:#000"> </span><span style=3D"color:#008">string</sp=
an><span style=3D"color:#000"> last_name</span><span style=3D"color:#660">,=
</span><span style=3D"color:#000"> </span><span style=3D"color:#008">unsign=
ed</span><span style=3D"color:#000"> age </span><span style=3D"color:#660">=
=3D</span><span style=3D"color:#000"> </span><span style=3D"color:#066">0</=
span><span style=3D"color:#660">)</span><span style=3D"color:#000"> </span>=
<span style=3D"color:#660">=3D</span><span style=3D"color:#000"> </span><sp=
an style=3D"color:#008">default</span><span style=3D"color:#660">;</span><s=
pan style=3D"color:#000"><br></span><span style=3D"color:#660">};</span></d=
iv></code></div><div><br></div><div>but notice that IMO this would never pa=
ss muster with the Committee, because it introduces a spooky interaction be=
tween the <i>spelling</i> of the <font face=3D"courier new, monospace">firs=
t_name</font> parameter to <font face=3D"courier new, monospace">Person::Pe=
rson</font> and the <i>spelling</i>=C2=A0of the <font face=3D"courier new, =
monospace">Person::first_name</font> data member. Everywhere in the current=
 language, parameter names &quot;don&#39;t matter&quot;; you can even omit =
them if you want. Having their <i>spelling</i> suddenly affect the code&#39=
;s=C2=A0<i>semantics</i> would be a huge deal, break refactoring tools acro=
ss the board, and just generally... yuck.</div><div><br></div><div>(B) This=
 idea is closely related (in my head at least) to proposals for supporting =
C99 designated initializer syntax in C++ and possibly for supporting named =
parameters (kwargs). You should look up some previous discussions of &quot;=
designated initializers&quot; in this group and see what people have said a=
bout them in the past. Yeah, it&#39;s not <i>quite</i> the same thing, but =
I see it as closely related.</div><div><br></div><div>(C) JetBrains&#39; CL=
ion IDE definitely has a keyboard shortcut to plop out all that boilerplate=
 for you, and I bet there are similar plugins for other IDEs. If you&#39;re=
 spending a significant amount of coding time on typing out these construct=
s, you ought to either change the kind of code you&#39;re writing (e.g., le=
arn to love <font face=3D"courier new, monospace">struct</font>, or possibl=
y switch jobs ;)), or get an IDE that supports quickly writing these constr=
ucts.</div><div><br></div><div>I don&#39;t think the language should change=
 to support writing this kind of code more efficiently; where &quot;this ki=
nd of code&quot; is code that uses</div><div>- lots of classes</div><div>- =
with public constructors</div><div>- taking parameters that are moved blind=
ly into the non-static data members of the class object under construction<=
/div><div>- (no checking of invariants, no non-trivial initialization logic=
)</div><div>- and where those non-static data members are non-public, or el=
se brace-initialization would solve the problem already.</div><div><br></di=
v><div>Finally, (D), a relatively trivial standardese nitpick: You don&#39;=
t provide any way to specify the public/private/protectedness of the genera=
ted constructor. My alternative syntax in (A) would solve that nitpick... b=
ut to be clear, I don&#39;t like my alternative syntax either. IMO this pro=
posal just doesn&#39;t solve a problem that a lot of people have in C++ tod=
ay.</div><div><br></div><div>=E2=80=93Arthur</div></div></blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/303348b5-48db-4a48-bcf9-2bf816950518%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/303348b5-48db-4a48-bcf9-2bf816950518=
%40isocpp.org</a>.<br />

------=_Part_39_2064981053.1459412828252--
------=_Part_38_527963648.1459412828251--

.


Author: ma.kalbfuss@web.de
Date: Thu, 31 Mar 2016 01:29:25 -0700 (PDT)
Raw View
------=_Part_88_197676835.1459412965713
Content-Type: multipart/alternative;
 boundary="----=_Part_89_1829040389.1459412965714"

------=_Part_89_1829040389.1459412965714
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

A minor correction of my private default constructor example: :-)
class Person
{

private:

    Person(string first_name, string last_name, unsigned age =3D 0) =3D def=
ault;

    explicit string first_name;    // explicit
    explicit string last_name;     // explicit
    explicit unsigned age =3D 0;     // optional with default value
    TelNum tel_num;                // implicit
};




Am Donnerstag, 31. M=C3=A4rz 2016 10:27:08 UTC+2 schrieb ma.ka...@web.de:
>
> The use of the name explicit was only a first suggestion. I would be=20
> perfectly fine with another name. The naming is not the point here.
> The default constructor is public by default as it always was. If you lik=
e=20
> to provide a private or protected default constructor you have to still=
=20
> explicitly state this.
>
>
> Best Regards
>
> Martin
>
>
> class Person
> {
>
> public:
>
>     Person(string first_name, string last_name, unsigned age =3D 0) =3D=
=20
> default;
>
>     explicit string first_name;    // explicit
>     explicit string last_name;     // explicit
>     explicit unsigned age =3D 0;     // optional with default value
>     TelNum tel_num;                // implicit
> };
>
> 1: "lots of classes". If I have a lot of code, it's likely that I have a=
=20
> lot of classes, too. I don't get your point. Is your argument to favor a=
=20
> functional style?
> 2: "with public constructors". The default constructor is already public.=
=20
> That's not part of my idea.
> 3: "taking parameters that are moved blindly into the non-static data=20
> members of the class object under construction". But It isn't blindly. Yo=
u=20
> explicitly state it.
> 4: "(no checking of invariants, no non-trivial initialization logic)".=20
> This is about the default constructor. It should handle default cases.=20
> Implementation of complex initialization logic is the job of the=20
> programmer. The compiler cannot handle such things well.
>
>
> Am Donnerstag, 31. M=C3=A4rz 2016 01:20:53 UTC+2 schrieb Arthur O'Dwyer:
>>
>> On Wednesday, March 30, 2016 at 1:31:07 PM UTC-7, ma.ka...@web.de wrote:
>>>
>>>
>>> I had an idea about explicit member variables. Explicit means, that the=
y=20
>>> have to be explicitly passed as parameters to the default constructor.
>>>
>>> class Person
>>> {
>>>     explicit string first_name;    // explicit
>>>     explicit string last_name;     // explicit
>>>     explicit unsigned age =3D 0;     // optional with default value
>>>     TelNum tel_num;                // implicit
>>> };
>>>
>>> This will generate a default constructor of the form
>>>
>>> Person::Person(string first_name, string last_name, unsigned age =3D 0)=
;
>>>
>>> What do you think?
>>>
>>
>> I think
>> (A) That's not what "explicit" means anywhere else in the language right=
=20
>> now, so I don't see why "explicit" is the right keyword. A much more=20
>> logical syntax given the existing language would be
>>
>> class Person
>> {
>>     string first_name;
>>     string last_name;
>>     unsigned age;
>>     TelNum tel_num;
>>   public:
>>     Person(string first_name, string last_name, unsigned age =3D 0) =3D=
=20
>> default;
>> };
>>
>> but notice that IMO this would never pass muster with the Committee,=20
>> because it introduces a spooky interaction between the *spelling* of the=
=20
>> first_name parameter to Person::Person and the *spelling* of the=20
>> Person::first_name data member. Everywhere in the current language,=20
>> parameter names "don't matter"; you can even omit them if you want. Havi=
ng=20
>> their *spelling* suddenly affect the code's *semantics* would be a huge=
=20
>> deal, break refactoring tools across the board, and just generally... yu=
ck.
>>
>> (B) This idea is closely related (in my head at least) to proposals for=
=20
>> supporting C99 designated initializer syntax in C++ and possibly for=20
>> supporting named parameters (kwargs). You should look up some previous=
=20
>> discussions of "designated initializers" in this group and see what peop=
le=20
>> have said about them in the past. Yeah, it's not *quite* the same thing,=
=20
>> but I see it as closely related.
>>
>> (C) JetBrains' CLion IDE definitely has a keyboard shortcut to plop out=
=20
>> all that boilerplate for you, and I bet there are similar plugins for ot=
her=20
>> IDEs. If you're spending a significant amount of coding time on typing o=
ut=20
>> these constructs, you ought to either change the kind of code you're=20
>> writing (e.g., learn to love struct, or possibly switch jobs ;)), or get=
=20
>> an IDE that supports quickly writing these constructs.
>>
>> I don't think the language should change to support writing this kind of=
=20
>> code more efficiently; where "this kind of code" is code that uses
>> - lots of classes
>> - with public constructors
>> - taking parameters that are moved blindly into the non-static data=20
>> members of the class object under construction
>> - (no checking of invariants, no non-trivial initialization logic)
>> - and where those non-static data members are non-public, or else=20
>> brace-initialization would solve the problem already.
>>
>> Finally, (D), a relatively trivial standardese nitpick: You don't provid=
e=20
>> any way to specify the public/private/protectedness of the generated=20
>> constructor. My alternative syntax in (A) would solve that nitpick... bu=
t=20
>> to be clear, I don't like my alternative syntax either. IMO this proposa=
l=20
>> just doesn't solve a problem that a lot of people have in C++ today.
>>
>> =E2=80=93Arthur
>>
>

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/02a299ad-a54d-4cf9-b329-60ada9caed60%40isocpp.or=
g.

------=_Part_89_1829040389.1459412965714
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">A minor correction of my private default constructor examp=
le: :-)<br><div style=3D"background-color:rgb(250,250,250);border-color:rgb=
(187,187,187);border-style:solid;border-width:1px;word-wrap:break-word"><co=
de><div><div style=3D"background-color:rgb(250,250,250);border-color:rgb(18=
7,187,187);border-style:solid;border-width:1px;word-wrap:break-word"><code>=
<div><span style=3D"color:#008"><span style=3D"color:#008">class</span></sp=
an><span style=3D"color:#000"><span style=3D"color:#000"> </span></span><sp=
an style=3D"color:#606"><span style=3D"color:#606">Person</span></span><spa=
n style=3D"color:#000"><span style=3D"color:#000"><br></span></span><span s=
tyle=3D"color:#660"><span style=3D"color:#660">{</span></span><span style=
=3D"color:#000"><span style=3D"color:#000"><br><br></span><span style=3D"co=
lor:#660">private:</span><span style=3D"color:#000"><br></span></span><br><=
span style=3D"color:#000"><span style=3D"color:#000"><code><code><span styl=
e=3D"color:#000"><span style=3D"color:#606">=C2=A0=C2=A0=C2=A0 Person</span=
><span style=3D"color:#660">(</span><span style=3D"color:#008">string</span=
><span style=3D"color:#000"> first_name</span><span style=3D"color:#660">,<=
/span><span style=3D"color:#000"> </span><span style=3D"color:#008">string<=
/span><span style=3D"color:#000"> last_name</span><span style=3D"color:#660=
">,</span><span style=3D"color:#000"> </span><span style=3D"color:#008">uns=
igned</span><span style=3D"color:#000"> age </span><span style=3D"color:#66=
0">=3D</span><span style=3D"color:#000"> </span><span style=3D"color:#066">=
0</span><span style=3D"color:#660">)</span><span style=3D"color:#000"> </sp=
an><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> </span>=
<span style=3D"color:#008">default</span><span style=3D"color:#660">;</span=
><span style=3D"color:#000"><br></span></span></code></code><br>=C2=A0 =C2=
=A0 </span></span><span style=3D"color:#008"><span style=3D"color:#008">exp=
licit</span></span><span style=3D"color:#000"><span style=3D"color:#000"> <=
/span></span><span style=3D"color:#008"><span style=3D"color:#008">string</=
span></span><span style=3D"color:#000"><span style=3D"color:#000"> first_na=
me</span></span><span style=3D"color:#660"><span style=3D"color:#660">;</sp=
an></span><span style=3D"color:#000"><span style=3D"color:#000"> =C2=A0 =C2=
=A0</span></span><span style=3D"color:#800"><span style=3D"color:#800">// e=
xplicit</span></span><span style=3D"color:#000"><span style=3D"color:#000">=
<br>=C2=A0 =C2=A0 </span></span><span style=3D"color:#008"><span style=3D"c=
olor:#008">explicit</span></span><span style=3D"color:#000"><span style=3D"=
color:#000"> </span></span><span style=3D"color:#008"><span style=3D"color:=
#008">string</span></span><span style=3D"color:#000"><span style=3D"color:#=
000"> last_name</span></span><span style=3D"color:#660"><span style=3D"colo=
r:#660">;</span></span><span style=3D"color:#000"><span style=3D"color:#000=
"> =C2=A0 =C2=A0 </span></span><span style=3D"color:#800"><span style=3D"co=
lor:#800">// explicit</span></span><span style=3D"color:#000"><span style=
=3D"color:#000"><br>=C2=A0 =C2=A0 </span></span><span style=3D"color:#008">=
<span style=3D"color:#008">explicit</span></span><span style=3D"color:#000"=
><span style=3D"color:#000"> </span></span><span style=3D"color:#008"><span=
 style=3D"color:#008">unsigned</span></span><span style=3D"color:#000"><spa=
n style=3D"color:#000"> age </span></span><span style=3D"color:#660"><span =
style=3D"color:#660">=3D</span></span><span style=3D"color:#000"><span styl=
e=3D"color:#000"> </span></span><span style=3D"color:#066"><span style=3D"c=
olor:#066">0</span></span><span style=3D"color:#660"><span style=3D"color:#=
660">;</span></span><span style=3D"color:#000"><span style=3D"color:#000"> =
=C2=A0 =C2=A0 </span></span><span style=3D"color:#800"><span style=3D"color=
:#800">// optional with default value</span></span><span style=3D"color:#00=
0"><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span></span><span style=
=3D"color:#606"><span style=3D"color:#606">TelNum</span></span><span style=
=3D"color:#000"><span style=3D"color:#000"> tel_num</span></span><span styl=
e=3D"color:#660"><span style=3D"color:#660">;</span></span><span style=3D"c=
olor:#000"><span style=3D"color:#000"> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0</span></span><span style=3D"color:#800"><span style=3D=
"color:#800">// implicit</span></span><span style=3D"color:#000"><span styl=
e=3D"color:#000"><br></span></span><span style=3D"color:#660"><span style=
=3D"color:#660">};</span></span><span style=3D"color:#000"><span style=3D"c=
olor:#000"><br></span></span></div></code></div></div></code></div><br><br>=
<br><br>Am Donnerstag, 31. M=C3=A4rz 2016 10:27:08 UTC+2 schrieb ma.ka...@w=
eb.de:<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">The use=
 of the name explicit was only a first suggestion. I would be perfectly fin=
e with another name. The naming is not the point here.<br>The default const=
ructor is public by default as it always was. If you like to provide a priv=
ate or protected default constructor you have to still explicitly state thi=
s.<br><br><br>Best Regards<br><br>Martin<br><br><br><div style=3D"backgroun=
d-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;b=
order-width:1px;word-wrap:break-word"><code><div><div style=3D"background-c=
olor:rgb(250,250,250);border-color:rgb(187,187,187);border-style:solid;bord=
er-width:1px;word-wrap:break-word"><code><div><span style=3D"color:#008"><s=
pan style=3D"color:#008">class</span></span><span style=3D"color:#000"><spa=
n style=3D"color:#000"> </span></span><span style=3D"color:#606"><span styl=
e=3D"color:#606">Person</span></span><span style=3D"color:#000"><span style=
=3D"color:#000"><br></span></span><span style=3D"color:#660"><span style=3D=
"color:#660">{</span></span><span style=3D"color:#000"><span style=3D"color=
:#000"><br><br></span><span style=3D"color:#008">public</span><span style=
=3D"color:#660">:</span><span style=3D"color:#000"><br></span></span><br><s=
pan style=3D"color:#000"><span style=3D"color:#000"><code><code><span style=
=3D"color:#000"><span style=3D"color:#606">=C2=A0=C2=A0=C2=A0 Person</span>=
<span style=3D"color:#660">(</span><span style=3D"color:#008">string</span>=
<span style=3D"color:#000"> first_name</span><span style=3D"color:#660">,</=
span><span style=3D"color:#000"> </span><span style=3D"color:#008">string</=
span><span style=3D"color:#000"> last_name</span><span style=3D"color:#660"=
>,</span><span style=3D"color:#000"> </span><span style=3D"color:#008">unsi=
gned</span><span style=3D"color:#000"> age </span><span style=3D"color:#660=
">=3D</span><span style=3D"color:#000"> </span><span style=3D"color:#066">0=
</span><span style=3D"color:#660">)</span><span style=3D"color:#000"> </spa=
n><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> </span><=
span style=3D"color:#008">default</span><span style=3D"color:#660">;</span>=
<span style=3D"color:#000"><br></span></span></code></code><br>=C2=A0 =C2=
=A0 </span></span><span style=3D"color:#008"><span style=3D"color:#008">exp=
licit</span></span><span style=3D"color:#000"><span style=3D"color:#000"> <=
/span></span><span style=3D"color:#008"><span style=3D"color:#008">string</=
span></span><span style=3D"color:#000"><span style=3D"color:#000"> first_na=
me</span></span><span style=3D"color:#660"><span style=3D"color:#660">;</sp=
an></span><span style=3D"color:#000"><span style=3D"color:#000"> =C2=A0 =C2=
=A0</span></span><span style=3D"color:#800"><span style=3D"color:#800">// e=
xplicit</span></span><span style=3D"color:#000"><span style=3D"color:#000">=
<br>=C2=A0 =C2=A0 </span></span><span style=3D"color:#008"><span style=3D"c=
olor:#008">explicit</span></span><span style=3D"color:#000"><span style=3D"=
color:#000"> </span></span><span style=3D"color:#008"><span style=3D"color:=
#008">string</span></span><span style=3D"color:#000"><span style=3D"color:#=
000"> last_name</span></span><span style=3D"color:#660"><span style=3D"colo=
r:#660">;</span></span><span style=3D"color:#000"><span style=3D"color:#000=
"> =C2=A0 =C2=A0 </span></span><span style=3D"color:#800"><span style=3D"co=
lor:#800">// explicit</span></span><span style=3D"color:#000"><span style=
=3D"color:#000"><br>=C2=A0 =C2=A0 </span></span><span style=3D"color:#008">=
<span style=3D"color:#008">explicit</span></span><span style=3D"color:#000"=
><span style=3D"color:#000"> </span></span><span style=3D"color:#008"><span=
 style=3D"color:#008">unsigned</span></span><span style=3D"color:#000"><spa=
n style=3D"color:#000"> age </span></span><span style=3D"color:#660"><span =
style=3D"color:#660">=3D</span></span><span style=3D"color:#000"><span styl=
e=3D"color:#000"> </span></span><span style=3D"color:#066"><span style=3D"c=
olor:#066">0</span></span><span style=3D"color:#660"><span style=3D"color:#=
660">;</span></span><span style=3D"color:#000"><span style=3D"color:#000"> =
=C2=A0 =C2=A0 </span></span><span style=3D"color:#800"><span style=3D"color=
:#800">// optional with default value</span></span><span style=3D"color:#00=
0"><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span></span><span style=
=3D"color:#606"><span style=3D"color:#606">TelNum</span></span><span style=
=3D"color:#000"><span style=3D"color:#000"> tel_num</span></span><span styl=
e=3D"color:#660"><span style=3D"color:#660">;</span></span><span style=3D"c=
olor:#000"><span style=3D"color:#000"> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0</span></span><span style=3D"color:#800"><span style=3D=
"color:#800">// implicit</span></span><span style=3D"color:#000"><span styl=
e=3D"color:#000"><br></span></span><span style=3D"color:#660"><span style=
=3D"color:#660">};</span></span><span style=3D"color:#000"><span style=3D"c=
olor:#000"><br></span></span></div></code></div></div></code></div><br>1: &=
quot;lots of classes&quot;. If I have a lot of code, it&#39;s likely that I=
 have a lot of classes, too. I don&#39;t get your point. Is your argument t=
o favor a functional style?<br>2: &quot;with public constructors&quot;. The=
 default constructor is already public. That&#39;s not part of my idea.<br>=
3: &quot;taking parameters that are moved blindly into the non-static data =
members of the class object under construction&quot;. But It isn&#39;t blin=
dly. You explicitly state it.<br>4: &quot;(no checking of invariants, no no=
n-trivial initialization logic)&quot;. This is about the default constructo=
r. It should handle default cases. Implementation of complex initialization=
 logic is the job of the programmer. The compiler cannot handle such things=
 well.<br><br><br>Am Donnerstag, 31. M=C3=A4rz 2016 01:20:53 UTC+2 schrieb =
Arthur O&#39;Dwyer:<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, March 30, 2016 at 1:31:07 PM UTC-7, <a>ma.ka...@web.de</a> w=
rote:<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>I had an =
idea about explicit member variables. Explicit means, that they have to be =
explicitly passed as parameters to the default constructor.<br><br><div sty=
le=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);borde=
r-style:solid;border-width:1px;word-wrap:break-word"><code><div><span style=
=3D"color:#008">class</span><span style=3D"color:#000"> </span><span style=
=3D"color:#606">Person</span><span style=3D"color:#000"><br></span><span st=
yle=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </s=
pan><span style=3D"color:#008">explicit</span><span style=3D"color:#000"> <=
/span><span style=3D"color:#008">string</span><span style=3D"color:#000"> f=
irst_name</span><span style=3D"color:#660">;</span><span style=3D"color:#00=
0"> =C2=A0 =C2=A0</span><span style=3D"color:#800">// explicit</span><span =
style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#008">ex=
plicit</span><span style=3D"color:#000"> </span><span style=3D"color:#008">=
string</span><span style=3D"color:#000"> last_name</span><span style=3D"col=
or:#660">;</span><span style=3D"color:#000"> =C2=A0 =C2=A0 </span><span sty=
le=3D"color:#800">// explicit</span><span style=3D"color:#000"><br>=C2=A0 =
=C2=A0 </span><span style=3D"color:#008">explicit</span><span style=3D"colo=
r:#000"> </span><span style=3D"color:#008">unsigned</span><span style=3D"co=
lor:#000"> age </span><span style=3D"color:#660">=3D</span><span style=3D"c=
olor:#000"> </span><span style=3D"color:#066">0</span><span style=3D"color:=
#660">;</span><span style=3D"color:#000"> =C2=A0 =C2=A0 </span><span style=
=3D"color:#800">// optional with default value</span><span style=3D"color:#=
000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#606">TelNum</span><span=
 style=3D"color:#000"> tel_num</span><span style=3D"color:#660">;</span><sp=
an style=3D"color:#000"> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0</span><span style=3D"color:#800">// implicit</span><span style=3D"co=
lor:#000"><br></span><span style=3D"color:#660">};</span><span style=3D"col=
or:#000"><br></span></div></code></div><br>This will generate a default con=
structor of the form<br><br><div style=3D"background-color:rgb(250,250,250)=
;border-color:rgb(187,187,187);border-style:solid;border-width:1px;word-wra=
p:break-word"><code><div><span style=3D"color:#606">Person</span><span styl=
e=3D"color:#660">::</span><span style=3D"color:#606">Person</span><span sty=
le=3D"color:#660">(</span><span style=3D"color:#008">string</span><span sty=
le=3D"color:#000"> first_name</span><span style=3D"color:#660">,</span><spa=
n style=3D"color:#000"> </span><span style=3D"color:#008">string</span><spa=
n style=3D"color:#000"> last_name</span><span style=3D"color:#660">,</span>=
<span style=3D"color:#000"> </span><span style=3D"color:#008">unsigned</spa=
n><span style=3D"color:#000"> age </span><span style=3D"color:#660">=3D</sp=
an><span style=3D"color:#000"> </span><span style=3D"color:#066">0</span><s=
pan style=3D"color:#660">);</span><span style=3D"color:#000"><br></span></d=
iv></code></div><br>What do you think?<br></div></blockquote><div><br></div=
><div>I think</div><div>(A) That&#39;s not what &quot;explicit&quot; means =
anywhere else in the language right now, so I don&#39;t see why &quot;expli=
cit&quot; is the right keyword. A much more logical syntax given the existi=
ng language would be</div><div><br></div><div style=3D"background-color:rgb=
(250,250,250);border:1px solid rgb(187,187,187);word-wrap:break-word"><code=
><div><span style=3D"color:#008">class</span><span style=3D"color:#000"> </=
span><span style=3D"color:#606">Person</span><span style=3D"color:#000"><br=
></span><span style=3D"color:#660">{</span><span style=3D"color:#000"><br>=
=C2=A0 =C2=A0 </span><span style=3D"color:#008">string</span><span style=3D=
"color:#000"> first_name</span><span style=3D"color:#660">;</span><span sty=
le=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#008">strin=
g</span><span style=3D"color:#000"> last_name</span><span style=3D"color:#6=
60">;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=
=3D"color:#008">unsigned</span><span style=3D"color:#000"> age</span><span =
style=3D"color:#660">;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 <=
/span><span style=3D"color:#606">TelNum</span><span style=3D"color:#000"> t=
el_num</span><span style=3D"color:#660">;</span><span style=3D"color:#000">=
<br>=C2=A0 </span><span style=3D"color:#008">public</span><span style=3D"co=
lor:#660">:</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span=
 style=3D"color:#606">Person</span><span style=3D"color:#660">(</span><span=
 style=3D"color:#008">string</span><span style=3D"color:#000"> first_name</=
span><span style=3D"color:#660">,</span><span style=3D"color:#000"> </span>=
<span style=3D"color:#008">string</span><span style=3D"color:#000"> last_na=
me</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> </s=
pan><span style=3D"color:#008">unsigned</span><span style=3D"color:#000"> a=
ge </span><span style=3D"color:#660">=3D</span><span style=3D"color:#000"> =
</span><span style=3D"color:#066">0</span><span style=3D"color:#660">)</spa=
n><span style=3D"color:#000"> </span><span style=3D"color:#660">=3D</span><=
span style=3D"color:#000"> </span><span style=3D"color:#008">default</span>=
<span style=3D"color:#660">;</span><span style=3D"color:#000"><br></span><s=
pan style=3D"color:#660">};</span></div></code></div><div><br></div><div>bu=
t notice that IMO this would never pass muster with the Committee, because =
it introduces a spooky interaction between the <i>spelling</i> of the <font=
 face=3D"courier new, monospace">first_name</font> parameter to <font face=
=3D"courier new, monospace">Person::Person</font> and the <i>spelling</i>=
=C2=A0of the <font face=3D"courier new, monospace">Person::first_name</font=
> data member. Everywhere in the current language, parameter names &quot;do=
n&#39;t matter&quot;; you can even omit them if you want. Having their <i>s=
pelling</i> suddenly affect the code&#39;s=C2=A0<i>semantics</i> would be a=
 huge deal, break refactoring tools across the board, and just generally...=
 yuck.</div><div><br></div><div>(B) This idea is closely related (in my hea=
d at least) to proposals for supporting C99 designated initializer syntax i=
n C++ and possibly for supporting named parameters (kwargs). You should loo=
k up some previous discussions of &quot;designated initializers&quot; in th=
is group and see what people have said about them in the past. Yeah, it&#39=
;s not <i>quite</i> the same thing, but I see it as closely related.</div><=
div><br></div><div>(C) JetBrains&#39; CLion IDE definitely has a keyboard s=
hortcut to plop out all that boilerplate for you, and I bet there are simil=
ar plugins for other IDEs. If you&#39;re spending a significant amount of c=
oding time on typing out these constructs, you ought to either change the k=
ind of code you&#39;re writing (e.g., learn to love <font face=3D"courier n=
ew, monospace">struct</font>, or possibly switch jobs ;)), or get an IDE th=
at supports quickly writing these constructs.</div><div><br></div><div>I do=
n&#39;t think the language should change to support writing this kind of co=
de more efficiently; where &quot;this kind of code&quot; is code that uses<=
/div><div>- lots of classes</div><div>- with public constructors</div><div>=
- taking parameters that are moved blindly into the non-static data members=
 of the class object under construction</div><div>- (no checking of invaria=
nts, no non-trivial initialization logic)</div><div>- and where those non-s=
tatic data members are non-public, or else brace-initialization would solve=
 the problem already.</div><div><br></div><div>Finally, (D), a relatively t=
rivial standardese nitpick: You don&#39;t provide any way to specify the pu=
blic/private/protectedness of the generated constructor. My alternative syn=
tax in (A) would solve that nitpick... but to be clear, I don&#39;t like my=
 alternative syntax either. IMO this proposal just doesn&#39;t solve a prob=
lem that a lot of people have in C++ today.</div><div><br></div><div>=E2=80=
=93Arthur</div></div></blockquote></div></blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/02a299ad-a54d-4cf9-b329-60ada9caed60%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/02a299ad-a54d-4cf9-b329-60ada9caed60=
%40isocpp.org</a>.<br />

------=_Part_89_1829040389.1459412965714--
------=_Part_88_197676835.1459412965713--

.


Author: Giovanni Piero Deretta <gpderetta@gmail.com>
Date: Thu, 31 Mar 2016 03:15:22 -0700 (PDT)
Raw View
------=_Part_8031_1201595279.1459419322762
Content-Type: multipart/alternative;
 boundary="----=_Part_8032_1079200881.1459419322763"

------=_Part_8032_1079200881.1459419322763
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Thursday, March 31, 2016 at 12:20:53 AM UTC+1, Arthur O'Dwyer wrote:
>
> On Wednesday, March 30, 2016 at 1:31:07 PM UTC-7, ma.ka...@web.de wrote:
>>
>>
>> I had an idea about explicit member variables. Explicit means, that they=
=20
>> have to be explicitly passed as parameters to the default constructor.
>>
> [...]=20

>
> I think
>
[...]=20

>
> (C) JetBrains' CLion IDE definitely has a keyboard shortcut to plop out=
=20
> all that boilerplate for you, and I bet there are similar plugins for oth=
er=20
> IDEs. If you're spending a significant amount of coding time on typing ou=
t=20
> these constructs, you ought to either change the kind of code you're=20
> writing (e.g., learn to love struct, or possibly switch jobs ;)), or get=
=20
> an IDE that supports quickly writing these constructs.
>

code generation is not a solution for the verboseness of the language. Even=
=20
generated piece of code need to be maintained.
=20

>
> I don't think the language should change to support writing this kind of=
=20
> code more efficiently; where "this kind of code" is code that uses
> - lots of classes
> - with public constructors
> - taking parameters that are moved blindly into the non-static data=20
> members of the class object under construction
> - (no checking of invariants, no non-trivial initialization logic)
> - and where those non-static data members are non-public, or else=20
> brace-initialization would solve the problem already.
>
>
often a struct is just a struct (i.e. just a tuple with named field with no=
=20
invariant). You just want to make sure that all fields are initialized=20
explicitly. I like the proposal. I'm not a huge fan of reusing explicit,=20
but it is not too bad either. Note that the extended aggregate=20
initialization in c++14 is 95% there: you have to use {} instead of () and=
=20
the compiler might or might not warn if you do not initialize some fields.=
=20
A small extension could be just an attribute like [[require_init]] that,=20
when using aggregate initialization would prompt the compiler to warn if=20
the field is not explicitly initialized.=20

Finally, (D), a relatively trivial standardese nitpick: You don't provide=
=20
> any way to specify the public/private/protectedness of the generated=20
> constructor. My alternative syntax in (A) would solve that nitpick... but=
=20
> to be clear, I don't like my alternative syntax either. IMO this proposal=
=20
> just doesn't solve a problem that a lot of people have in C++ today.
>
> =E2=80=93Arthur
>

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/ff8bcac0-0c60-412c-8d9e-95e935e74d2a%40isocpp.or=
g.

------=_Part_8032_1079200881.1459419322763
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Thursday, March 31, 2016 at 12:20:53 AM UTC+1, Arthur O=
&#39;Dwyer 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, March 30, 2016 at 1:31:07 PM UTC-7, <a>ma.ka...@web.de</a=
> wrote:<blockquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8=
ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><br>I had =
an idea about explicit member variables. Explicit means, that they have to =
be explicitly passed as parameters to the default constructor.<br></div></b=
lockquote></div></blockquote><div>[...] <br></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"><br><div>I think</div></div></blockquo=
te><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 d=
ir=3D"ltr"><br><div>(C) JetBrains&#39; CLion IDE definitely has a keyboard =
shortcut to plop out all that boilerplate for you, and I bet there are simi=
lar plugins for other IDEs. If you&#39;re spending a significant amount of =
coding time on typing out these constructs, you ought to either change the =
kind of code you&#39;re writing (e.g., learn to love <font face=3D"courier =
new, monospace">struct</font>, or possibly switch jobs ;)), or get an IDE t=
hat supports quickly writing these constructs.</div></div></blockquote><div=
><br>code generation is not a solution for the verboseness of the language.=
 Even generated piece of code need to be maintained.<br>=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><br></div><div>=
I don&#39;t think the language should change to support writing this kind o=
f code more efficiently; where &quot;this kind of code&quot; is code that u=
ses</div><div>- lots of classes</div><div>- with public constructors</div><=
div>- taking parameters that are moved blindly into the non-static data mem=
bers of the class object under construction</div><div>- (no checking of inv=
ariants, no non-trivial initialization logic)</div><div>- and where those n=
on-static data members are non-public, or else brace-initialization would s=
olve the problem already.</div><div><br></div></div></blockquote><div><br>o=
ften a struct is just a struct (i.e. just a tuple with named field with no =
invariant). You just want to make sure that all fields are initialized expl=
icitly. I like the proposal. I&#39;m not a huge fan of reusing explicit, bu=
t it is not too bad either. Note that the extended aggregate initialization=
 in c++14 is 95% there: you have to use {} instead of () and the compiler m=
ight or might not warn if you do not initialize some fields. A small extens=
ion could be just an attribute like [[require_init]] that, when using aggre=
gate initialization would prompt the compiler to warn if the field is not e=
xplicitly initialized. <br><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></div><div>Finally, (D), a relatively trivial =
standardese nitpick: You don&#39;t provide any way to specify the public/pr=
ivate/protectedness of the generated constructor. My alternative syntax in =
(A) would solve that nitpick... but to be clear, I don&#39;t like my altern=
ative syntax either. IMO this proposal just doesn&#39;t solve a problem tha=
t a lot of people have in C++ today.</div><div><br></div><div>=E2=80=93Arth=
ur</div></div></blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/ff8bcac0-0c60-412c-8d9e-95e935e74d2a%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/ff8bcac0-0c60-412c-8d9e-95e935e74d2a=
%40isocpp.org</a>.<br />

------=_Part_8032_1079200881.1459419322763--
------=_Part_8031_1201595279.1459419322762--

.


Author: ma.kalbfuss@web.de
Date: Thu, 31 Mar 2016 05:43:35 -0700 (PDT)
Raw View
------=_Part_6912_515723469.1459428215749
Content-Type: multipart/alternative;
 boundary="----=_Part_6913_1111451209.1459428215750"

------=_Part_6913_1111451209.1459428215750
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

An alternative Name would be required instead of explicit

class Person
{
    required string firstName;
    required string lastName;
    required unsigned age =3D 0;
};

int main(int argc, char **argv)
{
    // call of the automatically generated
    // default constructor.
    Person person1{ "Martin", "Kalbfu=C3=9F", 33 };

    // age is optional and defaults to 0
    Person person2{ "Winnie" "Puuh" };

    // Not allowed. Arguments are required
    //Person person3;

    return 0;
}




Am Mittwoch, 30. M=C3=A4rz 2016 22:31:07 UTC+2 schrieb ma.ka...@web.de:
>
> Hi Community,
>
> I had an idea about explicit member variables. Explicit means, that they=
=20
> have to be explicitly passed as parameters to the default constructor.
>
> class Person
> {
>     explicit string first_name;    // explicit
>     explicit string last_name;     // explicit
>     explicit unsigned age =3D 0;     // optional with default value
>     TelNum tel_num;                // implicit
> };
>
> This will generate a default constructor of the form
>
> Person::Person(string first_name, string last_name, unsigned age =3D 0);
>
> What do you think?
>
> Best Regards
>
> Martin Kalbfu=C3=9F
>

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/bc2e3688-c6b1-4ae7-b58a-07c109cb3590%40isocpp.or=
g.

------=_Part_6913_1111451209.1459428215750
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">An alternative Name would be required instead of explicit<=
br><br><div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, =
250); border-color: rgb(187, 187, 187); border-style: solid; border-width: =
1px; word-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subp=
rettyprint"><span style=3D"color: #008;" class=3D"styled-by-prettify">class=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><s=
pan style=3D"color: #606;" class=3D"styled-by-prettify">Person</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 required </span><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">string</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> firstName</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 required </span=
><span style=3D"color: #008;" class=3D"styled-by-prettify">string</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> lastName</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 required <=
/span><span style=3D"color: #008;" class=3D"styled-by-prettify">unsigned</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> age </span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #066;" class=3D"styled-by-prettify">0</span><span style=3D"color: #660=
;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">};</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"><br><br></span><span style=3D"color: #008;" class=3D"styled-by-pr=
ettify">int</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> main</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</s=
pan><span style=3D"color: #008;" class=3D"styled-by-prettify">int</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> argc</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">char</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">**</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify">argv</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">)</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </s=
pan><span style=3D"color: #800;" class=3D"styled-by-prettify">// call of th=
e automatically generated</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #800;" class=
=3D"styled-by-prettify">// default constructor.</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=
=3D"color: #606;" class=3D"styled-by-prettify">Person</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> person1</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> </span><span style=3D"color: #080;" class=
=3D"styled-by-prettify">&quot;Martin&quot;</span><span 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: #080;" class=3D"style=
d-by-prettify">&quot;Kalbfu=C3=9F&quot;</span><span 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: #066;" class=3D"styled-by=
-prettify">33</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">};</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br>=C2=A0=
 =C2=A0 </span><span style=3D"color: #800;" class=3D"styled-by-prettify">//=
 age is optional and defaults to 0</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #606=
;" class=3D"styled-by-prettify">Person</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"> person2</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #080;" class=3D"styled-by-pr=
ettify">&quot;Winnie&quot;</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #080;" class=3D"styled-by-pre=
ttify">&quot;Puuh&quot;</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">};</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
<br>=C2=A0 =C2=A0 </span><span style=3D"color: #800;" class=3D"styled-by-pr=
ettify">// Not allowed. Arguments are required</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D=
"color: #800;" class=3D"styled-by-prettify">//Person person3;</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br><br>=C2=A0 =C2=A0 </=
span><span style=3D"color: #008;" class=3D"styled-by-prettify">return</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span st=
yle=3D"color: #066;" class=3D"styled-by-prettify">0</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br></span></div></code></div><br><br><br><br>Am Mittwoch,=
 30. M=C3=A4rz 2016 22:31:07 UTC+2 schrieb ma.ka...@web.de:<blockquote clas=
s=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #c=
cc solid;padding-left: 1ex;"><div dir=3D"ltr">Hi Community,<br><br>I had an=
 idea about explicit member variables. Explicit means, that they have to be=
 explicitly passed as parameters to the default constructor.<br><br><div st=
yle=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,187);bord=
er-style:solid;border-width:1px;word-wrap:break-word"><code><div><span styl=
e=3D"color:#008">class</span><span style=3D"color:#000"> </span><span style=
=3D"color:#606">Person</span><span style=3D"color:#000"><br></span><span st=
yle=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </s=
pan><span style=3D"color:#008">explicit</span><span style=3D"color:#000"> <=
/span><span style=3D"color:#008">string</span><span style=3D"color:#000"> f=
irst_name</span><span style=3D"color:#660">;</span><span style=3D"color:#00=
0"> =C2=A0 =C2=A0</span><span style=3D"color:#800">// explicit</span><span =
style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#008">ex=
plicit</span><span style=3D"color:#000"> </span><span style=3D"color:#008">=
string</span><span style=3D"color:#000"> last_name</span><span style=3D"col=
or:#660">;</span><span style=3D"color:#000"> =C2=A0 =C2=A0 </span><span sty=
le=3D"color:#800">// explicit</span><span style=3D"color:#000"><br>=C2=A0 =
=C2=A0 </span><span style=3D"color:#008">explicit</span><span style=3D"colo=
r:#000"> </span><span style=3D"color:#008">unsigned</span><span style=3D"co=
lor:#000"> age </span><span style=3D"color:#660">=3D</span><span style=3D"c=
olor:#000"> </span><span style=3D"color:#066">0</span><span style=3D"color:=
#660">;</span><span style=3D"color:#000"> =C2=A0 =C2=A0 </span><span style=
=3D"color:#800">// optional with default value</span><span style=3D"color:#=
000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#606">TelNum</span><span=
 style=3D"color:#000"> tel_num</span><span style=3D"color:#660">;</span><sp=
an style=3D"color:#000"> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0</span><span style=3D"color:#800">// implicit</span><span style=3D"co=
lor:#000"><br></span><span style=3D"color:#660">};</span><span style=3D"col=
or:#000"><br></span></div></code></div><br>This will generate a default con=
structor of the form<br><br><div style=3D"background-color:rgb(250,250,250)=
;border-color:rgb(187,187,187);border-style:solid;border-width:1px;word-wra=
p:break-word"><code><div><span style=3D"color:#606">Person</span><span styl=
e=3D"color:#660">::</span><span style=3D"color:#606">Person</span><span sty=
le=3D"color:#660">(</span><span style=3D"color:#008">string</span><span sty=
le=3D"color:#000"> first_name</span><span style=3D"color:#660">,</span><spa=
n style=3D"color:#000"> </span><span style=3D"color:#008">string</span><spa=
n style=3D"color:#000"> last_name</span><span style=3D"color:#660">,</span>=
<span style=3D"color:#000"> </span><span style=3D"color:#008">unsigned</spa=
n><span style=3D"color:#000"> age </span><span style=3D"color:#660">=3D</sp=
an><span style=3D"color:#000"> </span><span style=3D"color:#066">0</span><s=
pan style=3D"color:#660">);</span><span style=3D"color:#000"><br></span></d=
iv></code></div><br>What do you think?<br><br>Best Regards<br><br>Martin Ka=
lbfu=C3=9F<br></div></blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/bc2e3688-c6b1-4ae7-b58a-07c109cb3590%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/bc2e3688-c6b1-4ae7-b58a-07c109cb3590=
%40isocpp.org</a>.<br />

------=_Part_6913_1111451209.1459428215750--
------=_Part_6912_515723469.1459428215749--

.


Author: Giovanni Piero Deretta <gpderetta@gmail.com>
Date: Thu, 31 Mar 2016 07:10:29 -0700 (PDT)
Raw View
------=_Part_270_1850367753.1459433429258
Content-Type: multipart/alternative;
 boundary="----=_Part_271_195712697.1459433429259"

------=_Part_271_195712697.1459433429259
Content-Type: text/plain; charset=UTF-8

On Thursday, March 31, 2016 at 1:43:36 PM UTC+1, ma.ka...@web.de wrote:
>
> An alternative Name would be required instead of explicit
>
>
Another suggestion:

class Person {
    string firstName;
    string lastName;
    unsigned age = 0;
public:
        Person = default;
};

i.e. no control on which members are exposed in the constructor, but you
get to define the visibility of the constructor itself.

-- gpd


--
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/d6b08908-f9c0-4835-a42f-12efae56c32a%40isocpp.org.

------=_Part_271_195712697.1459433429259
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Thursday, March 31, 2016 at 1:43:36 PM UTC+1, ma.ka...@=
web.de wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-le=
ft: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">=
An alternative Name would be required instead of explicit<br><br></div></bl=
ockquote><div><br>Another suggestion:<br><br>class Person {<br><code><span =
style=3D"color:#000">=C2=A0=C2=A0=C2=A0 </span><span style=3D"color:#008">s=
tring</span><span style=3D"color:#000"> firstName</span><span style=3D"colo=
r:#660">;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span s=
tyle=3D"color:#008">string</span><span style=3D"color:#000"> lastName</span=
><span style=3D"color:#660">;</span><span style=3D"color:#000"><br>=C2=A0 =
=C2=A0 </span><span style=3D"color:#008">unsigned</span><span style=3D"colo=
r:#000"> age </span><span style=3D"color:#660">=3D</span><span style=3D"col=
or:#000"> </span><span style=3D"color:#066">0</span><span style=3D"color:#6=
60"></span></code>;<br>public:<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=
=A0 Person =3D default;<br>};<br><br>i.e. no control on which members are e=
xposed in the constructor, but you get to define the visibility of the cons=
tructor itself. <br><br>-- gpd<br></div><br><br></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/d6b08908-f9c0-4835-a42f-12efae56c32a%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/d6b08908-f9c0-4835-a42f-12efae56c32a=
%40isocpp.org</a>.<br />

------=_Part_271_195712697.1459433429259--
------=_Part_270_1850367753.1459433429258--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Thu, 31 Mar 2016 08:01:06 -0700 (PDT)
Raw View
------=_Part_626_2055093603.1459436466345
Content-Type: multipart/alternative;
 boundary="----=_Part_627_1838231772.1459436466345"

------=_Part_627_1838231772.1459436466345
Content-Type: text/plain; charset=UTF-8

On Thursday, March 31, 2016 at 6:15:22 AM UTC-4, Giovanni Piero Deretta
wrote:
>
> On Thursday, March 31, 2016 at 12:20:53 AM UTC+1, Arthur O'Dwyer wrote:
>>
>> On Wednesday, March 30, 2016 at 1:31:07 PM UTC-7, ma.ka...@web.de wrote:
>>>
>>>
>>> I had an idea about explicit member variables. Explicit means, that they
>>> have to be explicitly passed as parameters to the default constructor.
>>>
>> [...]
>
>>
>> I think
>>
> [...]
>
>>
>> (C) JetBrains' CLion IDE definitely has a keyboard shortcut to plop out
>> all that boilerplate for you, and I bet there are similar plugins for other
>> IDEs. If you're spending a significant amount of coding time on typing out
>> these constructs, you ought to either change the kind of code you're
>> writing (e.g., learn to love struct, or possibly switch jobs ;)), or get
>> an IDE that supports quickly writing these constructs.
>>
>
> code generation is not a solution for the verboseness of the language.
> Even generated piece of code need to be maintained.
>
>
>>
>> I don't think the language should change to support writing this kind of
>> code more efficiently; where "this kind of code" is code that uses
>> - lots of classes
>> - with public constructors
>> - taking parameters that are moved blindly into the non-static data
>> members of the class object under construction
>> - (no checking of invariants, no non-trivial initialization logic)
>> - and where those non-static data members are non-public, or else
>> brace-initialization would solve the problem already.
>>
>>
> often a struct is just a struct (i.e. just a tuple with named field with
> no invariant). You just want to make sure that all fields are initialized
> explicitly.
>

If you *need* to "make sure that all fields are initialized explicitly",
then it is not "just a struct" anymore. It is a live object with a genuine
invariant. Namely, that its fields were not default-initialized.

And if you don't *need* to ensure initialization of all fields, then that's
a decision that should be given to the user. It's up to them to fill in the
data or not, as they see fit.

Either you have an invariant or you don't. It seems to me that what you
want is a loose invariant.

--
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/ce1a007c-0193-4de4-986d-008da2ba1e2f%40isocpp.org.

------=_Part_627_1838231772.1459436466345
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Thursday, March 31, 2016 at 6:15:22 AM UTC-4, Giovanni =
Piero Deretta wrote:<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">On Thursday, March 31, 2016 at 12:20:53 AM UTC+1, Arthur O&#39;Dwy=
er 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 Wednes=
day, March 30, 2016 at 1:31:07 PM UTC-7, <a>ma.ka...@web.de</a> wrote:<bloc=
kquote 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"><br>I had an idea about=
 explicit member variables. Explicit means, that they have to be explicitly=
 passed as parameters to the default constructor.<br></div></blockquote></d=
iv></blockquote><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"><br><div>I think</div></div></blockquote><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"><br><div>(C)=
 JetBrains&#39; CLion IDE definitely has a keyboard shortcut to plop out al=
l that boilerplate for you, and I bet there are similar plugins for other I=
DEs. If you&#39;re spending a significant amount of coding time on typing o=
ut these constructs, you ought to either change the kind of code you&#39;re=
 writing (e.g., learn to love <font face=3D"courier new, monospace">struct<=
/font>, or possibly switch jobs ;)), or get an IDE that supports quickly wr=
iting these constructs.</div></div></blockquote><div><br>code generation is=
 not a solution for the verboseness of the language. Even generated piece o=
f code need to be maintained.<br>=C2=A0</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><br></div><div>I don&#39;t think the langua=
ge should change to support writing this kind of code more efficiently; whe=
re &quot;this kind of code&quot; is code that uses</div><div>- lots of clas=
ses</div><div>- with public constructors</div><div>- taking parameters that=
 are moved blindly into the non-static data members of the class object und=
er construction</div><div>- (no checking of invariants, no non-trivial init=
ialization logic)</div><div>- and where those non-static data members are n=
on-public, or else brace-initialization would solve the problem already.</d=
iv><div><br></div></div></blockquote><div><br>often a struct is just a stru=
ct (i.e. just a tuple with named field with no invariant). You just want to=
 make sure that all fields are initialized explicitly.</div></div></blockqu=
ote><div><br>If you <i>need</i> to &quot;make sure that all fields are init=
ialized explicitly&quot;, then it is not &quot;just a struct&quot; anymore.=
 It is a live object with a genuine invariant. Namely, that its fields were=
 not default-initialized.<br><br>And if you don&#39;t <i>need</i> to ensure=
 initialization of all fields, then that&#39;s a decision that should be gi=
ven to the user. It&#39;s up to them to fill in the data or not, as they se=
e fit.<br><br>Either you have an invariant or you don&#39;t. It seems to me=
 that what you want is a loose invariant.<br></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/ce1a007c-0193-4de4-986d-008da2ba1e2f%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/ce1a007c-0193-4de4-986d-008da2ba1e2f=
%40isocpp.org</a>.<br />

------=_Part_627_1838231772.1459436466345--
------=_Part_626_2055093603.1459436466345--

.


Author: ma.kalbfuss@web.de
Date: Thu, 31 Mar 2016 10:12:41 -0700 (PDT)
Raw View
------=_Part_565_1772962618.1459444361167
Content-Type: multipart/alternative;
 boundary="----=_Part_566_341623032.1459444361168"

------=_Part_566_341623032.1459444361168
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Hi Giovanni,

your version has even less redundancy but less control, too. What about=20
renaming required to require and allow three variants:

First variant:
class Person
{
    require string firstName;
    require string lastName;
    require unsigned age =3D 0;
};

Second variant:
class Person
{
    require {
        string firstName;
        string lastName;
        unsigned age =3D 0;
    }
};

Third variant:
class Person
{
    require all;

    string firstName;
    string lastName;
    unsigned age =3D 0;
};


Am Donnerstag, 31. M=C3=A4rz 2016 16:10:29 UTC+2 schrieb Giovanni Piero Der=
etta:
>
> On Thursday, March 31, 2016 at 1:43:36 PM UTC+1, ma.ka...@web.de wrote:
>>
>> An alternative Name would be required instead of explicit
>>
>>
> Another suggestion:
>
> class Person {
>     string firstName;
>     string lastName;
>     unsigned age =3D 0;
> public:
>         Person =3D default;
> };
>
> i.e. no control on which members are exposed in the constructor, but you=
=20
> get to define the visibility of the constructor itself.=20
>
> -- gpd
>
>
>

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/98793e5c-708a-4704-b40b-afd590a52969%40isocpp.or=
g.

------=_Part_566_341623032.1459444361168
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi Giovanni,<br><br>your version has even less redundancy =
but less control, too. What about renaming required to require and allow th=
ree variants:<br><br>First variant:<br><div class=3D"prettyprint" style=3D"=
background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); bor=
der-style: solid; border-width: 1px; word-wrap: break-word;"><code class=3D=
"prettyprint"><div class=3D"subprettyprint"><code><span style=3D"color:#008=
"><span style=3D"color: #008;" class=3D"styled-by-prettify">class</span></s=
pan><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> </span></span><span style=3D"color:#606"><span style=3D"colo=
r: #606;" class=3D"styled-by-prettify">Person</span></span><span style=3D"c=
olor:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></=
span></span><span style=3D"color:#660"><span style=3D"color: #660;" class=
=3D"styled-by-prettify">{</span></span><span style=3D"color:#000"><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><=
span style=3D"color: #008;" class=3D"styled-by-prettify">require</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span></span><span =
style=3D"color:#008"><span style=3D"color: #008;" class=3D"styled-by-pretti=
fy">string</span></span><span style=3D"color:#000"><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> firstName</span></span><span style=3D"co=
lor:#660"><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span=
></span><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">require</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span></span><span style=3D"color:#008"><span sty=
le=3D"color: #008;" class=3D"styled-by-prettify">string</span></span><span =
style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> lastName</span></span><span style=3D"color:#660"><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">;</span></span><span style=3D"color:#0=
00"><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =
=C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-prettify">req=
uire</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </spa=
n></span><span style=3D"color:#008"><span style=3D"color: #008;" class=3D"s=
tyled-by-prettify">unsigned</span></span><span style=3D"color:#000"><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> age </span></span><span=
 style=3D"color:#660"><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">=3D</span></span><span style=3D"color:#000"><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> </span></span><span style=3D"color:#066"><=
span style=3D"color: #066;" class=3D"styled-by-prettify">0</span></span><sp=
an style=3D"color:#660"><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">;</span></span><span style=3D"color:#000"><span style=3D"color: #000=
;" class=3D"styled-by-prettify"><br></span></span><span style=3D"color:#660=
"><span style=3D"color: #660;" class=3D"styled-by-prettify">};</span></span=
><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by=
-prettify"><br></span></span></code></div></code></div><br>Second variant:<=
br><div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250)=
; border-color: rgb(187, 187, 187); border-style: solid; border-width: 1px;=
 word-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subprett=
yprint"><code><span style=3D"color:#008"><span style=3D"color: #008;" class=
=3D"styled-by-prettify">class</span></span><span style=3D"color:#000"><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"> </span></span><span s=
tyle=3D"color:#606"><span style=3D"color: #606;" class=3D"styled-by-prettif=
y">Person</span></span><span style=3D"color:#000"><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"><br></span></span><span style=3D"color:#66=
0"><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span></span=
><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by=
-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"s=
tyled-by-prettify">require</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><b=
r>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span></span><span style=3D"color:#008"><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">string</span></span><=
span style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> firstName</span></span><span style=3D"color:#660"><span style=3D"=
color: #660;" class=3D"styled-by-prettify">;</span></span><span style=3D"co=
lor:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 </span></span><span style=3D"color:#008"><span sty=
le=3D"color: #008;" class=3D"styled-by-prettify">string</span></span><span =
style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> lastName</span></span><span style=3D"color:#660"><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">;</span></span><span style=3D"color:#0=
00"><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 </span></span><span style=3D"color:#008"><span style=
=3D"color: #008;" class=3D"styled-by-prettify">unsigned</span></span><span =
style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> age </span></span><span style=3D"color:#660"><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">=3D</span></span><span style=3D"color:#000=
"><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span></span>=
<span style=3D"color:#066"><span style=3D"color: #066;" class=3D"styled-by-=
prettify">0</span></span><span style=3D"color:#660"><span style=3D"color: #=
660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">}</span></span><span style=3D"color:#000"=
><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span></spa=
n><span style=3D"color:#660"><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">};</span></span><span style=3D"color:#000"><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br></span></span></code></div></code=
></div><br>Third variant:<br><div class=3D"prettyprint" style=3D"background=
-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style:=
 solid; border-width: 1px; word-wrap: break-word;"><code class=3D"prettypri=
nt"><div class=3D"subprettyprint"><div class=3D"prettyprint" style=3D"borde=
r: 1px solid rgb(187, 187, 187); word-wrap: break-word;"><code class=3D"pre=
ttyprint"><div class=3D"subprettyprint"><code><span style=3D"color:#008">cl=
ass</span><span style=3D"color:#000"> </span><span style=3D"color:#606">Per=
son</span><span style=3D"color:#000"><br></span><span style=3D"color:#660">=
{</span><span style=3D"color:#000"><br>=C2=A0=C2=A0=C2=A0 require all;<br><=
br>=C2=A0 =C2=A0 </span><span style=3D"color:#008">string</span><span style=
=3D"color:#000"> firstName</span><span style=3D"color:#660">;</span><span s=
tyle=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#008">str=
ing</span><span style=3D"color:#000"> lastName</span><span style=3D"color:#=
660">;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span styl=
e=3D"color:#008">unsigned</span><span style=3D"color:#000"> age </span><spa=
n style=3D"color:#660">=3D</span><span style=3D"color:#000"> </span><span s=
tyle=3D"color:#066">0</span><span style=3D"color:#660">;</span><span style=
=3D"color:#000"><br></span><span style=3D"color:#660">};</span><span style=
=3D"color:#000"><br></span></code></div></code></div></div></code></div><di=
v><br></div><br>Am Donnerstag, 31. M=C3=A4rz 2016 16:10:29 UTC+2 schrieb Gi=
ovanni Piero Deretta:<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">On Thursday, March 31, 2016 at 1:43:36 PM UTC+1, <a>ma.ka...@web.d=
e</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">An alt=
ernative Name would be required instead of explicit<br><br></div></blockquo=
te><div><br>Another suggestion:<br><br>class Person {<br><code><span style=
=3D"color:#000">=C2=A0=C2=A0=C2=A0 </span><span style=3D"color:#008">string=
</span><span style=3D"color:#000"> firstName</span><span style=3D"color:#66=
0">;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=
=3D"color:#008">string</span><span style=3D"color:#000"> lastName</span><sp=
an style=3D"color:#660">;</span><span style=3D"color:#000"><br>=C2=A0 =C2=
=A0 </span><span style=3D"color:#008">unsigned</span><span style=3D"color:#=
000"> age </span><span style=3D"color:#660">=3D</span><span style=3D"color:=
#000"> </span><span style=3D"color:#066">0</span><span style=3D"color:#660"=
></span></code>;<br>public:<br>=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 P=
erson =3D default;<br>};<br><br>i.e. no control on which members are expose=
d in the constructor, but you get to define the visibility of the construct=
or itself. <br><br>-- gpd<br></div><br><br></div></blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/98793e5c-708a-4704-b40b-afd590a52969%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/98793e5c-708a-4704-b40b-afd590a52969=
%40isocpp.org</a>.<br />

------=_Part_566_341623032.1459444361168--
------=_Part_565_1772962618.1459444361167--

.


Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Thu, 31 Mar 2016 20:15:28 +0300
Raw View
On 31 March 2016 at 20:12,  <ma.kalbfuss@web.de> wrote:
> Hi Giovanni,
>
> your version has even less redundancy but less control, too. What about
> renaming required to require and allow three variants:
>
> First variant:
> class Person
> {
>     require string firstName;
>     require string lastName;
>     require unsigned age = 0;
> };
>
> Second variant:
> class Person
> {
>     require {
>         string firstName;
>         string lastName;
>         unsigned age = 0;
>     }
> };
>
> Third variant:
> class Person
> {
>     require all;
>
>     string firstName;
>     string lastName;
>     unsigned age = 0;
> };


If you want to require certain values to be provided for
initialization, why exactly do you not just write a constructor?
The motivation of this idea seems unclear still, and there's no
comparison to status-quo solutions. You will need those
if you wish to write a successful paper.

--
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/CAFk2RUZMk-EwKLqp8WxNKJCdCm81xoDY0TT%2B_FmgaFKzxvq0ew%40mail.gmail.com.

.


Author: "'Johannes Schaub' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Thu, 31 Mar 2016 19:23:48 +0200
Raw View
I would not require putting explicit before each and every member. You
have left it out of "TelNum", but what does that mean? Will the
constructor leave the member with an uninitialized value? IMO that's
bad because it will make "Person{a, b, c}" leave tel_num
uninitialized, while initializing it when you remove all the
"explicit" keywords.

IMO this thing is a property of the class: You want to allow or forbid
elision of initializers. Status quo is that "Person{name}" is allowed,
and initialize the remaining three using default values
(zero/null/=3D.../etc). I'm proposing to forbid this when you mark a
class with a special way. Someone recommended something along the
lines of "Person(a, b, c) =3D default;". I like that, but it requires
repetition of names. You want to write a parameter list with meaning
"all my members". Perhaps this would be viable, imitating the syntax
of member function pointers and looking like a wildcard operator on
A's scope:

    A(A::*) =3D default;

Defaulting this "Aggregate constructor" would make a A{...} use this
ctor and using normal function semantics forbid leaving out members.

2016-03-30 22:31 GMT+02:00  <ma.kalbfuss@web.de>:
> Hi Community,
>
> I had an idea about explicit member variables. Explicit means, that they
> have to be explicitly passed as parameters to the default constructor.
>
> class Person
> {
>     explicit string first_name;    // explicit
>     explicit string last_name;     // explicit
>     explicit unsigned age =3D 0;     // optional with default value
>     TelNum tel_num;                // implicit
> };
>
> This will generate a default constructor of the form
>
> Person::Person(string first_name, string last_name, unsigned age =3D 0);
>
> What do you think?
>
> Best Regards
>
> Martin Kalbfu=C3=9F
>
> --
> 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/a03295e3-57f=
6-4f72-8f6a-3b4d1f2c7e90%40isocpp.org.

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/CANu6V4WoEzydbKMnKDmxYizHQJ94-SFjgJ4B4XFZXTnvg1T=
A0Q%40mail.gmail.com.

.


Author: ma.kalbfuss@web.de
Date: Thu, 31 Mar 2016 10:28:54 -0700 (PDT)
Raw View
------=_Part_7126_1810300475.1459445334589
Content-Type: multipart/alternative;
 boundary="----=_Part_7127_1588596622.1459445334589"

------=_Part_7127_1588596622.1459445334589
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

There are two reasons for this proposal,

- The first one is to reduce redundancy. While writing the constructor=20
yourself, you have to repeat the member names 3 times. Once in de parameter=
=20
list. And two times in the initialization list.
You write down the variable names 4 times. If you separate declaration and=
=20
definition it's even 5 times.

- The second one is to enforce initialization by the user without loosing=
=20
simplicity of the class/struct. This is strongly related to the first point=
=20
but worth to mention it separately.


Am Donnerstag, 31. M=C3=A4rz 2016 19:15:30 UTC+2 schrieb Ville Voutilainen:
>
> On 31 March 2016 at 20:12,  <ma.ka...@web.de <javascript:>> wrote:=20
> > Hi Giovanni,=20
> >=20
> > your version has even less redundancy but less control, too. What about=
=20
> > renaming required to require and allow three variants:=20
> >=20
> > First variant:=20
> > class Person=20
> > {=20
> >     require string firstName;=20
> >     require string lastName;=20
> >     require unsigned age =3D 0;=20
> > };=20
> >=20
> > Second variant:=20
> > class Person=20
> > {=20
> >     require {=20
> >         string firstName;=20
> >         string lastName;=20
> >         unsigned age =3D 0;=20
> >     }=20
> > };=20
> >=20
> > Third variant:=20
> > class Person=20
> > {=20
> >     require all;=20
> >=20
> >     string firstName;=20
> >     string lastName;=20
> >     unsigned age =3D 0;=20
> > };=20
>
>
> If you want to require certain values to be provided for=20
> initialization, why exactly do you not just write a constructor?=20
> The motivation of this idea seems unclear still, and there's no=20
> comparison to status-quo solutions. You will need those=20
> if you wish to write a successful paper.=20
>

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/d6c42479-4e05-48f6-8d73-a0abdd74f153%40isocpp.or=
g.

------=_Part_7127_1588596622.1459445334589
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">There are two reasons for this proposal,<div><br></div><di=
v>- The first one is to reduce redundancy. While writing the constructor yo=
urself, you have to repeat the member names 3 times. Once in de parameter l=
ist. And two times in the initialization list.</div><div>You write down the=
 variable names 4 times. If you separate declaration and definition it&#39;=
s even 5 times.</div><div><br></div><div>- The second one is to enforce ini=
tialization by the user without loosing simplicity of the class/struct. Thi=
s is strongly related to the first point but worth to mention it separately=
..</div><div><br></div><div><br>Am Donnerstag, 31. M=C3=A4rz 2016 19:15:30 U=
TC+2 schrieb Ville Voutilainen:<blockquote class=3D"gmail_quote" style=3D"m=
argin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"=
>On 31 March 2016 at 20:12, =C2=A0&lt;<a href=3D"javascript:" target=3D"_bl=
ank" gdf-obfuscated-mailto=3D"4Y6nl-8qAAAJ" rel=3D"nofollow" onmousedown=3D=
"this.href=3D&#39;javascript:&#39;;return true;" onclick=3D"this.href=3D&#3=
9;javascript:&#39;;return true;">ma.ka...@web.de</a>&gt; wrote:
<br>&gt; Hi Giovanni,
<br>&gt;
<br>&gt; your version has even less redundancy but less control, too. What =
about
<br>&gt; renaming required to require and allow three variants:
<br>&gt;
<br>&gt; First variant:
<br>&gt; class Person
<br>&gt; {
<br>&gt; =C2=A0 =C2=A0 require string firstName;
<br>&gt; =C2=A0 =C2=A0 require string lastName;
<br>&gt; =C2=A0 =C2=A0 require unsigned age =3D 0;
<br>&gt; };
<br>&gt;
<br>&gt; Second variant:
<br>&gt; class Person
<br>&gt; {
<br>&gt; =C2=A0 =C2=A0 require {
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 string firstName;
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 string lastName;
<br>&gt; =C2=A0 =C2=A0 =C2=A0 =C2=A0 unsigned age =3D 0;
<br>&gt; =C2=A0 =C2=A0 }
<br>&gt; };
<br>&gt;
<br>&gt; Third variant:
<br>&gt; class Person
<br>&gt; {
<br>&gt; =C2=A0 =C2=A0 require all;
<br>&gt;
<br>&gt; =C2=A0 =C2=A0 string firstName;
<br>&gt; =C2=A0 =C2=A0 string lastName;
<br>&gt; =C2=A0 =C2=A0 unsigned age =3D 0;
<br>&gt; };
<br>
<br>
<br>If you want to require certain values to be provided for
<br>initialization, why exactly do you not just write a constructor?
<br>The motivation of this idea seems unclear still, and there&#39;s no
<br>comparison to status-quo solutions. You will need those
<br>if you wish to write a successful paper.
<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&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/d6c42479-4e05-48f6-8d73-a0abdd74f153%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/d6c42479-4e05-48f6-8d73-a0abdd74f153=
%40isocpp.org</a>.<br />

------=_Part_7127_1588596622.1459445334589--
------=_Part_7126_1810300475.1459445334589--

.


Author: ma.kalbfuss@web.de
Date: Thu, 31 Mar 2016 10:34:52 -0700 (PDT)
Raw View
------=_Part_2304_564322794.1459445692266
Content-Type: multipart/alternative;
 boundary="----=_Part_2305_1077383583.1459445692267"

------=_Part_2305_1077383583.1459445692267
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

In my example the default constructor of tel_num, if any, should be called.=
=20
Otherwise the member is left uninitialized. But this is not a weak point of=
=20
my idea. Its the normal behaviour of the default constructor.

Am Donnerstag, 31. M=C3=A4rz 2016 19:23:50 UTC+2 schrieb Johannes Schaub:
>
> I would not require putting explicit before each and every member. You=20
> have left it out of "TelNum", but what does that mean? Will the=20
> constructor leave the member with an uninitialized value? IMO that's=20
> bad because it will make "Person{a, b, c}" leave tel_num=20
> uninitialized, while initializing it when you remove all the=20
> "explicit" keywords.=20
>
> IMO this thing is a property of the class: You want to allow or forbid=20
> elision of initializers. Status quo is that "Person{name}" is allowed,=20
> and initialize the remaining three using default values=20
> (zero/null/=3D.../etc). I'm proposing to forbid this when you mark a=20
> class with a special way. Someone recommended something along the=20
> lines of "Person(a, b, c) =3D default;". I like that, but it requires=20
> repetition of names. You want to write a parameter list with meaning=20
> "all my members". Perhaps this would be viable, imitating the syntax=20
> of member function pointers and looking like a wildcard operator on=20
> A's scope:=20
>
>     A(A::*) =3D default;=20
>
> Defaulting this "Aggregate constructor" would make a A{...} use this=20
> ctor and using normal function semantics forbid leaving out members.=20
>
> 2016-03-30 22:31 GMT+02:00  <ma.ka...@web.de <javascript:>>:=20
> > Hi Community,=20
> >=20
> > I had an idea about explicit member variables. Explicit means, that the=
y=20
> > have to be explicitly passed as parameters to the default constructor.=
=20
> >=20
> > class Person=20
> > {=20
> >     explicit string first_name;    // explicit=20
> >     explicit string last_name;     // explicit=20
> >     explicit unsigned age =3D 0;     // optional with default value=20
> >     TelNum tel_num;                // implicit=20
> > };=20
> >=20
> > This will generate a default constructor of the form=20
> >=20
> > Person::Person(string first_name, string last_name, unsigned age =3D 0)=
;=20
> >=20
> > What do you think?=20
> >=20
> > Best Regards=20
> >=20
> > Martin Kalbfu=C3=9F=20
> >=20
> > --=20
> > You received this message because you are subscribed to the Google=20
> Groups=20
> > "ISO C++ Standard - Future Proposals" group.=20
> > To unsubscribe from this group and stop receiving emails from it, send=
=20
> an=20
> > email to std-proposal...@isocpp.org <javascript:>.=20
> > To post to this group, send email to std-pr...@isocpp.org <javascript:>=
..=20
>
> > To view this discussion on the web visit=20
> >=20
> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/a03295e3-57f=
6-4f72-8f6a-3b4d1f2c7e90%40isocpp.org.=20
>
>

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/7ec366e6-009e-4031-bd53-14198002fa4b%40isocpp.or=
g.

------=_Part_2305_1077383583.1459445692267
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>In my example the default constructor of tel_num, if =
any, should be called. Otherwise the member is left uninitialized. But this=
 is not a weak point of my idea. Its the normal behaviour of the default co=
nstructor.</div><div><br>Am Donnerstag, 31. M=C3=A4rz 2016 19:23:50 UTC+2 s=
chrieb Johannes Schaub:<blockquote class=3D"gmail_quote" style=3D"margin: 0=
;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">I would=
 not require putting explicit before each and every member. You
<br>have left it out of &quot;TelNum&quot;, but what does that mean? Will t=
he
<br>constructor leave the member with an uninitialized value? IMO that&#39;=
s
<br>bad because it will make &quot;Person{a, b, c}&quot; leave tel_num
<br>uninitialized, while initializing it when you remove all the
<br>&quot;explicit&quot; keywords.
<br>
<br>IMO this thing is a property of the class: You want to allow or forbid
<br>elision of initializers. Status quo is that &quot;Person{name}&quot; is=
 allowed,
<br>and initialize the remaining three using default values
<br>(zero/null/=3D.../etc). I&#39;m proposing to forbid this when you mark =
a
<br>class with a special way. Someone recommended something along the
<br>lines of &quot;Person(a, b, c) =3D default;&quot;. I like that, but it =
requires
<br>repetition of names. You want to write a parameter list with meaning
<br>&quot;all my members&quot;. Perhaps this would be viable, imitating the=
 syntax
<br>of member function pointers and looking like a wildcard operator on
<br>A&#39;s scope:
<br>
<br>=C2=A0 =C2=A0 A(A::*) =3D default;
<br>
<br>Defaulting this &quot;Aggregate constructor&quot; would make a A{...} u=
se this
<br>ctor and using normal function semantics forbid leaving out members.
<br>
<br>2016-03-30 22:31 GMT+02:00 =C2=A0&lt;<a href=3D"javascript:" target=3D"=
_blank" gdf-obfuscated-mailto=3D"N0BcMGQrAAAJ" rel=3D"nofollow" onmousedown=
=3D"this.href=3D&#39;javascript:&#39;;return true;" onclick=3D"this.href=3D=
&#39;javascript:&#39;;return true;">ma.ka...@web.de</a>&gt;:
<br>&gt; Hi Community,
<br>&gt;
<br>&gt; I had an idea about explicit member variables. Explicit means, tha=
t they
<br>&gt; have to be explicitly passed as parameters to the default construc=
tor.
<br>&gt;
<br>&gt; class Person
<br>&gt; {
<br>&gt; =C2=A0 =C2=A0 explicit string first_name; =C2=A0 =C2=A0// explicit
<br>&gt; =C2=A0 =C2=A0 explicit string last_name; =C2=A0 =C2=A0 // explicit
<br>&gt; =C2=A0 =C2=A0 explicit unsigned age =3D 0; =C2=A0 =C2=A0 // option=
al with default value
<br>&gt; =C2=A0 =C2=A0 TelNum tel_num; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0// implicit
<br>&gt; };
<br>&gt;
<br>&gt; This will generate a default constructor of the form
<br>&gt;
<br>&gt; Person::Person(string first_name, string last_name, unsigned age =
=3D 0);
<br>&gt;
<br>&gt; What do you think?
<br>&gt;
<br>&gt; Best Regards
<br>&gt;
<br>&gt; Martin Kalbfu=C3=9F
<br>&gt;
<br>&gt; --
<br>&gt; You received this message because you are subscribed to the Google=
 Groups
<br>&gt; &quot;ISO C++ Standard - Future Proposals&quot; group.
<br>&gt; To unsubscribe from this group and stop receiving emails from it, =
send an
<br>&gt; email to <a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-=
mailto=3D"N0BcMGQrAAAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;ja=
vascript:&#39;;return true;" onclick=3D"this.href=3D&#39;javascript:&#39;;r=
eturn true;">std-proposal...@<wbr>isocpp.org</a>.
<br>&gt; To post to this group, send email to <a href=3D"javascript:" targe=
t=3D"_blank" gdf-obfuscated-mailto=3D"N0BcMGQrAAAJ" rel=3D"nofollow" onmous=
edown=3D"this.href=3D&#39;javascript:&#39;;return true;" onclick=3D"this.hr=
ef=3D&#39;javascript:&#39;;return true;">std-pr...@isocpp.org</a>.
<br>&gt; To view this discussion on the web visit
<br>&gt; <a href=3D"https://groups.google.com/a/isocpp.org/d/msgid/std-prop=
osals/a03295e3-57f6-4f72-8f6a-3b4d1f2c7e90%40isocpp.org" target=3D"_blank" =
rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;https://groups.google.com/=
a/isocpp.org/d/msgid/std-proposals/a03295e3-57f6-4f72-8f6a-3b4d1f2c7e90%40i=
socpp.org&#39;;return true;" onclick=3D"this.href=3D&#39;https://groups.goo=
gle.com/a/isocpp.org/d/msgid/std-proposals/a03295e3-57f6-4f72-8f6a-3b4d1f2c=
7e90%40isocpp.org&#39;;return true;">https://groups.google.com/a/<wbr>isocp=
p.org/d/msgid/std-<wbr>proposals/a03295e3-57f6-4f72-<wbr>8f6a-3b4d1f2c7e90%=
40isocpp.org</a><wbr>.
<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&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/7ec366e6-009e-4031-bd53-14198002fa4b%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/7ec366e6-009e-4031-bd53-14198002fa4b=
%40isocpp.org</a>.<br />

------=_Part_2305_1077383583.1459445692267--
------=_Part_2304_564322794.1459445692266--

.


Author: "'Johannes Schaub' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Date: Thu, 31 Mar 2016 19:54:11 +0200
Raw View
It's the normal behavior of the default constructor, but not the
normal behavior of an absent constructor + using () or {} to create
the object.

struct A { int x, y; };
A().x =3D=3D 0; // OK

But

struct A { A() { } int x, y; };
A().x =3D=3D 0; // undefined behavior.

Therefore, I would expect that in your code, it's an error to make
tel_num implicit, to be on the safe side.

2016-03-31 19:34 GMT+02:00  <ma.kalbfuss@web.de>:
> In my example the default constructor of tel_num, if any, should be calle=
d.
> Otherwise the member is left uninitialized. But this is not a weak point =
of
> my idea. Its the normal behaviour of the default constructor.
>
> Am Donnerstag, 31. M=C3=A4rz 2016 19:23:50 UTC+2 schrieb Johannes Schaub:
>>
>> I would not require putting explicit before each and every member. You
>> have left it out of "TelNum", but what does that mean? Will the
>> constructor leave the member with an uninitialized value? IMO that's
>> bad because it will make "Person{a, b, c}" leave tel_num
>> uninitialized, while initializing it when you remove all the
>> "explicit" keywords.
>>
>> IMO this thing is a property of the class: You want to allow or forbid
>> elision of initializers. Status quo is that "Person{name}" is allowed,
>> and initialize the remaining three using default values
>> (zero/null/=3D.../etc). I'm proposing to forbid this when you mark a
>> class with a special way. Someone recommended something along the
>> lines of "Person(a, b, c) =3D default;". I like that, but it requires
>> repetition of names. You want to write a parameter list with meaning
>> "all my members". Perhaps this would be viable, imitating the syntax
>> of member function pointers and looking like a wildcard operator on
>> A's scope:
>>
>>     A(A::*) =3D default;
>>
>> Defaulting this "Aggregate constructor" would make a A{...} use this
>> ctor and using normal function semantics forbid leaving out members.
>>
>> 2016-03-30 22:31 GMT+02:00  <ma.ka...@web.de>:
>> > Hi Community,
>> >
>> > I had an idea about explicit member variables. Explicit means, that th=
ey
>> > have to be explicitly passed as parameters to the default constructor.
>> >
>> > class Person
>> > {
>> >     explicit string first_name;    // explicit
>> >     explicit string last_name;     // explicit
>> >     explicit unsigned age =3D 0;     // optional with default value
>> >     TelNum tel_num;                // implicit
>> > };
>> >
>> > This will generate a default constructor of the form
>> >
>> > Person::Person(string first_name, string last_name, unsigned age =3D 0=
);
>> >
>> > What do you think?
>> >
>> > Best Regards
>> >

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/CANu6V4UsVh5%3DFkM61zkV1-BgBRvavVS%3DnjVf6Ck0W-f=
EYRw%3Djw%40mail.gmail.com.

.


Author: ma.kalbfuss@web.de
Date: Thu, 31 Mar 2016 11:36:23 -0700 (PDT)
Raw View
------=_Part_693_1956183176.1459449383186
Content-Type: multipart/alternative;
 boundary="----=_Part_694_700595346.1459449383186"

------=_Part_694_700595346.1459449383186
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Are you sure about

struct A { int x, y; };=20
A().x =3D=3D 0; // OK

I don't think that's true. The default behaviour is to leave primitive=20
members uninitialized. Maybe I'm not up to date and missed a change. But=20
either way. The created constructor should behave like the current default=
=20
constructor does for members not prefixed by the require keyword.


Am Donnerstag, 31. M=C3=A4rz 2016 19:54:14 UTC+2 schrieb Johannes Schaub:
>
> It's the normal behavior of the default constructor, but not the=20
> normal behavior of an absent constructor + using () or {} to create=20
> the object.=20
>
> struct A { int x, y; };=20
> A().x =3D=3D 0; // OK=20
>
> But=20
>
> struct A { A() { } int x, y; };=20
> A().x =3D=3D 0; // undefined behavior.=20
>
> Therefore, I would expect that in your code, it's an error to make=20
> tel_num implicit, to be on the safe side.=20
>
> 2016-03-31 19:34 GMT+02:00  <ma.ka...@web.de <javascript:>>:=20
> > In my example the default constructor of tel_num, if any, should be=20
> called.=20
> > Otherwise the member is left uninitialized. But this is not a weak poin=
t=20
> of=20
> > my idea. Its the normal behaviour of the default constructor.=20
> >=20
> > Am Donnerstag, 31. M=C3=A4rz 2016 19:23:50 UTC+2 schrieb Johannes Schau=
b:=20
> >>=20
> >> I would not require putting explicit before each and every member. You=
=20
> >> have left it out of "TelNum", but what does that mean? Will the=20
> >> constructor leave the member with an uninitialized value? IMO that's=
=20
> >> bad because it will make "Person{a, b, c}" leave tel_num=20
> >> uninitialized, while initializing it when you remove all the=20
> >> "explicit" keywords.=20
> >>=20
> >> IMO this thing is a property of the class: You want to allow or forbid=
=20
> >> elision of initializers. Status quo is that "Person{name}" is allowed,=
=20
> >> and initialize the remaining three using default values=20
> >> (zero/null/=3D.../etc). I'm proposing to forbid this when you mark a=
=20
> >> class with a special way. Someone recommended something along the=20
> >> lines of "Person(a, b, c) =3D default;". I like that, but it requires=
=20
> >> repetition of names. You want to write a parameter list with meaning=
=20
> >> "all my members". Perhaps this would be viable, imitating the syntax=
=20
> >> of member function pointers and looking like a wildcard operator on=20
> >> A's scope:=20
> >>=20
> >>     A(A::*) =3D default;=20
> >>=20
> >> Defaulting this "Aggregate constructor" would make a A{...} use this=
=20
> >> ctor and using normal function semantics forbid leaving out members.=
=20
> >>=20
> >> 2016-03-30 22:31 GMT+02:00  <ma.ka...@web.de>:=20
> >> > Hi Community,=20
> >> >=20
> >> > I had an idea about explicit member variables. Explicit means, that=
=20
> they=20
> >> > have to be explicitly passed as parameters to the default=20
> constructor.=20
> >> >=20
> >> > class Person=20
> >> > {=20
> >> >     explicit string first_name;    // explicit=20
> >> >     explicit string last_name;     // explicit=20
> >> >     explicit unsigned age =3D 0;     // optional with default value=
=20
> >> >     TelNum tel_num;                // implicit=20
> >> > };=20
> >> >=20
> >> > This will generate a default constructor of the form=20
> >> >=20
> >> > Person::Person(string first_name, string last_name, unsigned age =3D=
=20
> 0);=20
> >> >=20
> >> > What do you think?=20
> >> >=20
> >> > Best Regards=20
> >> >=20
>

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/b76d5b72-2520-4b23-a3eb-2142cc5e4e71%40isocpp.or=
g.

------=_Part_694_700595346.1459449383186
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Are you sure about</div><div><br></div><div><div clas=
s=3D"prettyprint" style=3D"border: 1px solid rgb(187, 187, 187); word-wrap:=
 break-word; background-color: rgb(250, 250, 250);"><code class=3D"prettypr=
int"><div class=3D"subprettyprint"><span style=3D"font-family: Arial, Helve=
tica, sans-serif; background-color: rgb(255, 255, 255);">struct A { int x, =
y; };</span><span style=3D"font-family: Arial, Helvetica, sans-serif; backg=
round-color: rgb(255, 255, 255);">=C2=A0</span></div><div class=3D"subprett=
yprint"><span style=3D"color: #000;" class=3D"styled-by-prettify"><span sty=
le=3D"font-family: Arial, Helvetica, sans-serif; color: rgb(34, 34, 34); ba=
ckground-color: rgb(255, 255, 255);">A().x =3D=3D 0; // OK</span></span></d=
iv></code></div><br>I don&#39;t think that&#39;s true. The default behaviou=
r is to leave primitive members uninitialized. Maybe I&#39;m not up to date=
 and missed a change. But either way. The created constructor should behave=
 like the current default constructor does for members not prefixed by the =
require keyword.<br><br><br>Am Donnerstag, 31. M=C3=A4rz 2016 19:54:14 UTC+=
2 schrieb Johannes Schaub:<blockquote class=3D"gmail_quote" style=3D"margin=
: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">It&#=
39;s the normal behavior of the default constructor, but not the
<br>normal behavior of an absent constructor + using () or {} to create
<br>the object.
<br>
<br>struct A { int x, y; };
<br>A().x =3D=3D 0; // OK
<br>
<br>But
<br>
<br>struct A { A() { } int x, y; };
<br>A().x =3D=3D 0; // undefined behavior.
<br>
<br>Therefore, I would expect that in your code, it&#39;s an error to make
<br>tel_num implicit, to be on the safe side.
<br>
<br>2016-03-31 19:34 GMT+02:00 =C2=A0&lt;<a href=3D"javascript:" target=3D"=
_blank" gdf-obfuscated-mailto=3D"klxCuwwtAAAJ" rel=3D"nofollow" onmousedown=
=3D"this.href=3D&#39;javascript:&#39;;return true;" onclick=3D"this.href=3D=
&#39;javascript:&#39;;return true;">ma.ka...@web.de</a>&gt;:
<br>&gt; In my example the default constructor of tel_num, if any, should b=
e called.
<br>&gt; Otherwise the member is left uninitialized. But this is not a weak=
 point of
<br>&gt; my idea. Its the normal behaviour of the default constructor.
<br>&gt;
<br>&gt; Am Donnerstag, 31. M=C3=A4rz 2016 19:23:50 UTC+2 schrieb Johannes =
Schaub:
<br>&gt;&gt;
<br>&gt;&gt; I would not require putting explicit before each and every mem=
ber. You
<br>&gt;&gt; have left it out of &quot;TelNum&quot;, but what does that mea=
n? Will the
<br>&gt;&gt; constructor leave the member with an uninitialized value? IMO =
that&#39;s
<br>&gt;&gt; bad because it will make &quot;Person{a, b, c}&quot; leave tel=
_num
<br>&gt;&gt; uninitialized, while initializing it when you remove all the
<br>&gt;&gt; &quot;explicit&quot; keywords.
<br>&gt;&gt;
<br>&gt;&gt; IMO this thing is a property of the class: You want to allow o=
r forbid
<br>&gt;&gt; elision of initializers. Status quo is that &quot;Person{name}=
&quot; is allowed,
<br>&gt;&gt; and initialize the remaining three using default values
<br>&gt;&gt; (zero/null/=3D.../etc). I&#39;m proposing to forbid this when =
you mark a
<br>&gt;&gt; class with a special way. Someone recommended something along =
the
<br>&gt;&gt; lines of &quot;Person(a, b, c) =3D default;&quot;. I like that=
, but it requires
<br>&gt;&gt; repetition of names. You want to write a parameter list with m=
eaning
<br>&gt;&gt; &quot;all my members&quot;. Perhaps this would be viable, imit=
ating the syntax
<br>&gt;&gt; of member function pointers and looking like a wildcard operat=
or on
<br>&gt;&gt; A&#39;s scope:
<br>&gt;&gt;
<br>&gt;&gt; =C2=A0 =C2=A0 A(A::*) =3D default;
<br>&gt;&gt;
<br>&gt;&gt; Defaulting this &quot;Aggregate constructor&quot; would make a=
 A{...} use this
<br>&gt;&gt; ctor and using normal function semantics forbid leaving out me=
mbers.
<br>&gt;&gt;
<br>&gt;&gt; 2016-03-30 22:31 GMT+02:00 =C2=A0&lt;<a>ma.ka...@web.de</a>&gt=
;:
<br>&gt;&gt; &gt; Hi Community,
<br>&gt;&gt; &gt;
<br>&gt;&gt; &gt; I had an idea about explicit member variables. Explicit m=
eans, that they
<br>&gt;&gt; &gt; have to be explicitly passed as parameters to the default=
 constructor.
<br>&gt;&gt; &gt;
<br>&gt;&gt; &gt; class Person
<br>&gt;&gt; &gt; {
<br>&gt;&gt; &gt; =C2=A0 =C2=A0 explicit string first_name; =C2=A0 =C2=A0//=
 explicit
<br>&gt;&gt; &gt; =C2=A0 =C2=A0 explicit string last_name; =C2=A0 =C2=A0 //=
 explicit
<br>&gt;&gt; &gt; =C2=A0 =C2=A0 explicit unsigned age =3D 0; =C2=A0 =C2=A0 =
// optional with default value
<br>&gt;&gt; &gt; =C2=A0 =C2=A0 TelNum tel_num; =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0// implicit
<br>&gt;&gt; &gt; };
<br>&gt;&gt; &gt;
<br>&gt;&gt; &gt; This will generate a default constructor of the form
<br>&gt;&gt; &gt;
<br>&gt;&gt; &gt; Person::Person(string first_name, string last_name, unsig=
ned age =3D 0);
<br>&gt;&gt; &gt;
<br>&gt;&gt; &gt; What do you think?
<br>&gt;&gt; &gt;
<br>&gt;&gt; &gt; Best Regards
<br>&gt;&gt; &gt;
<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&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/b76d5b72-2520-4b23-a3eb-2142cc5e4e71%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/b76d5b72-2520-4b23-a3eb-2142cc5e4e71=
%40isocpp.org</a>.<br />

------=_Part_694_700595346.1459449383186--
------=_Part_693_1956183176.1459449383186--

.


Author: ma.kalbfuss@web.de
Date: Thu, 31 Mar 2016 11:41:19 -0700 (PDT)
Raw View
------=_Part_697_447176331.1459449679189
Content-Type: multipart/alternative;
 boundary="----=_Part_698_32016004.1459449679189"

------=_Part_698_32016004.1459449679189
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Ah OK. I missed the {}/(). Sorry for that. I'm currently not sure about the=
=20
best solution. I habe to think about it.
Thanks for the insight.

Am Donnerstag, 31. M=C3=A4rz 2016 19:54:14 UTC+2 schrieb Johannes Schaub:
>
> It's the normal behavior of the default constructor, but not the=20
> normal behavior of an absent constructor + using () or {} to create=20
> the object.=20
>
> struct A { int x, y; };=20
> A().x =3D=3D 0; // OK=20
>
> But=20
>
> struct A { A() { } int x, y; };=20
> A().x =3D=3D 0; // undefined behavior.=20
>
> Therefore, I would expect that in your code, it's an error to make=20
> tel_num implicit, to be on the safe side.=20
>
> 2016-03-31 19:34 GMT+02:00  <ma.ka...@web.de <javascript:>>:=20
> > In my example the default constructor of tel_num, if any, should be=20
> called.=20
> > Otherwise the member is left uninitialized. But this is not a weak poin=
t=20
> of=20
> > my idea. Its the normal behaviour of the default constructor.=20
> >=20
> > Am Donnerstag, 31. M=C3=A4rz 2016 19:23:50 UTC+2 schrieb Johannes Schau=
b:=20
> >>=20
> >> I would not require putting explicit before each and every member. You=
=20
> >> have left it out of "TelNum", but what does that mean? Will the=20
> >> constructor leave the member with an uninitialized value? IMO that's=
=20
> >> bad because it will make "Person{a, b, c}" leave tel_num=20
> >> uninitialized, while initializing it when you remove all the=20
> >> "explicit" keywords.=20
> >>=20
> >> IMO this thing is a property of the class: You want to allow or forbid=
=20
> >> elision of initializers. Status quo is that "Person{name}" is allowed,=
=20
> >> and initialize the remaining three using default values=20
> >> (zero/null/=3D.../etc). I'm proposing to forbid this when you mark a=
=20
> >> class with a special way. Someone recommended something along the=20
> >> lines of "Person(a, b, c) =3D default;". I like that, but it requires=
=20
> >> repetition of names. You want to write a parameter list with meaning=
=20
> >> "all my members". Perhaps this would be viable, imitating the syntax=
=20
> >> of member function pointers and looking like a wildcard operator on=20
> >> A's scope:=20
> >>=20
> >>     A(A::*) =3D default;=20
> >>=20
> >> Defaulting this "Aggregate constructor" would make a A{...} use this=
=20
> >> ctor and using normal function semantics forbid leaving out members.=
=20
> >>=20
> >> 2016-03-30 22:31 GMT+02:00  <ma.ka...@web.de>:=20
> >> > Hi Community,=20
> >> >=20
> >> > I had an idea about explicit member variables. Explicit means, that=
=20
> they=20
> >> > have to be explicitly passed as parameters to the default=20
> constructor.=20
> >> >=20
> >> > class Person=20
> >> > {=20
> >> >     explicit string first_name;    // explicit=20
> >> >     explicit string last_name;     // explicit=20
> >> >     explicit unsigned age =3D 0;     // optional with default value=
=20
> >> >     TelNum tel_num;                // implicit=20
> >> > };=20
> >> >=20
> >> > This will generate a default constructor of the form=20
> >> >=20
> >> > Person::Person(string first_name, string last_name, unsigned age =3D=
=20
> 0);=20
> >> >=20
> >> > What do you think?=20
> >> >=20
> >> > Best Regards=20
> >> >=20
>

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/d146b327-a87c-42de-b041-cda6bcea8d25%40isocpp.or=
g.

------=_Part_698_32016004.1459449679189
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Ah OK. I missed the {}/(). Sorry for that. I&#39;m current=
ly not sure about the best solution. I habe to think about it.<div>Thanks f=
or the insight.<br><div><br>Am Donnerstag, 31. M=C3=A4rz 2016 19:54:14 UTC+=
2 schrieb Johannes Schaub:<blockquote class=3D"gmail_quote" style=3D"margin=
: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">It&#=
39;s the normal behavior of the default constructor, but not the
<br>normal behavior of an absent constructor + using () or {} to create
<br>the object.
<br>
<br>struct A { int x, y; };
<br>A().x =3D=3D 0; // OK
<br>
<br>But
<br>
<br>struct A { A() { } int x, y; };
<br>A().x =3D=3D 0; // undefined behavior.
<br>
<br>Therefore, I would expect that in your code, it&#39;s an error to make
<br>tel_num implicit, to be on the safe side.
<br>
<br>2016-03-31 19:34 GMT+02:00 =C2=A0&lt;<a href=3D"javascript:" target=3D"=
_blank" gdf-obfuscated-mailto=3D"klxCuwwtAAAJ" rel=3D"nofollow" onmousedown=
=3D"this.href=3D&#39;javascript:&#39;;return true;" onclick=3D"this.href=3D=
&#39;javascript:&#39;;return true;">ma.ka...@web.de</a>&gt;:
<br>&gt; In my example the default constructor of tel_num, if any, should b=
e called.
<br>&gt; Otherwise the member is left uninitialized. But this is not a weak=
 point of
<br>&gt; my idea. Its the normal behaviour of the default constructor.
<br>&gt;
<br>&gt; Am Donnerstag, 31. M=C3=A4rz 2016 19:23:50 UTC+2 schrieb Johannes =
Schaub:
<br>&gt;&gt;
<br>&gt;&gt; I would not require putting explicit before each and every mem=
ber. You
<br>&gt;&gt; have left it out of &quot;TelNum&quot;, but what does that mea=
n? Will the
<br>&gt;&gt; constructor leave the member with an uninitialized value? IMO =
that&#39;s
<br>&gt;&gt; bad because it will make &quot;Person{a, b, c}&quot; leave tel=
_num
<br>&gt;&gt; uninitialized, while initializing it when you remove all the
<br>&gt;&gt; &quot;explicit&quot; keywords.
<br>&gt;&gt;
<br>&gt;&gt; IMO this thing is a property of the class: You want to allow o=
r forbid
<br>&gt;&gt; elision of initializers. Status quo is that &quot;Person{name}=
&quot; is allowed,
<br>&gt;&gt; and initialize the remaining three using default values
<br>&gt;&gt; (zero/null/=3D.../etc). I&#39;m proposing to forbid this when =
you mark a
<br>&gt;&gt; class with a special way. Someone recommended something along =
the
<br>&gt;&gt; lines of &quot;Person(a, b, c) =3D default;&quot;. I like that=
, but it requires
<br>&gt;&gt; repetition of names. You want to write a parameter list with m=
eaning
<br>&gt;&gt; &quot;all my members&quot;. Perhaps this would be viable, imit=
ating the syntax
<br>&gt;&gt; of member function pointers and looking like a wildcard operat=
or on
<br>&gt;&gt; A&#39;s scope:
<br>&gt;&gt;
<br>&gt;&gt; =C2=A0 =C2=A0 A(A::*) =3D default;
<br>&gt;&gt;
<br>&gt;&gt; Defaulting this &quot;Aggregate constructor&quot; would make a=
 A{...} use this
<br>&gt;&gt; ctor and using normal function semantics forbid leaving out me=
mbers.
<br>&gt;&gt;
<br>&gt;&gt; 2016-03-30 22:31 GMT+02:00 =C2=A0&lt;<a>ma.ka...@web.de</a>&gt=
;:
<br>&gt;&gt; &gt; Hi Community,
<br>&gt;&gt; &gt;
<br>&gt;&gt; &gt; I had an idea about explicit member variables. Explicit m=
eans, that they
<br>&gt;&gt; &gt; have to be explicitly passed as parameters to the default=
 constructor.
<br>&gt;&gt; &gt;
<br>&gt;&gt; &gt; class Person
<br>&gt;&gt; &gt; {
<br>&gt;&gt; &gt; =C2=A0 =C2=A0 explicit string first_name; =C2=A0 =C2=A0//=
 explicit
<br>&gt;&gt; &gt; =C2=A0 =C2=A0 explicit string last_name; =C2=A0 =C2=A0 //=
 explicit
<br>&gt;&gt; &gt; =C2=A0 =C2=A0 explicit unsigned age =3D 0; =C2=A0 =C2=A0 =
// optional with default value
<br>&gt;&gt; &gt; =C2=A0 =C2=A0 TelNum tel_num; =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0// implicit
<br>&gt;&gt; &gt; };
<br>&gt;&gt; &gt;
<br>&gt;&gt; &gt; This will generate a default constructor of the form
<br>&gt;&gt; &gt;
<br>&gt;&gt; &gt; Person::Person(string first_name, string last_name, unsig=
ned age =3D 0);
<br>&gt;&gt; &gt;
<br>&gt;&gt; &gt; What do you think?
<br>&gt;&gt; &gt;
<br>&gt;&gt; &gt; Best Regards
<br>&gt;&gt; &gt;
<br></blockquote></div></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/d146b327-a87c-42de-b041-cda6bcea8d25%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/d146b327-a87c-42de-b041-cda6bcea8d25=
%40isocpp.org</a>.<br />

------=_Part_698_32016004.1459449679189--
------=_Part_697_447176331.1459449679189--

.


Author: ma.kalbfuss@web.de
Date: Thu, 31 Mar 2016 13:02:45 -0700 (PDT)
Raw View
------=_Part_590_1974436587.1459454565145
Content-Type: multipart/alternative;
 boundary="----=_Part_591_1344341972.1459454565146"

------=_Part_591_1344341972.1459454565146
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Afte some research I think the best option is, that the type loose its=20
state as POD if there is at least one require. What do you think about this=
=20
solution?

Am Donnerstag, 31. M=C3=A4rz 2016 19:54:14 UTC+2 schrieb Johannes Schaub:
>
> It's the normal behavior of the default constructor, but not the=20
> normal behavior of an absent constructor + using () or {} to create=20
> the object.=20
>
> struct A { int x, y; };=20
> A().x =3D=3D 0; // OK=20
>
> But=20
>
> struct A { A() { } int x, y; };=20
> A().x =3D=3D 0; // undefined behavior.=20
>
> Therefore, I would expect that in your code, it's an error to make=20
> tel_num implicit, to be on the safe side.=20
>
> 2016-03-31 19:34 GMT+02:00  <ma.ka...@web.de <javascript:>>:=20
> > In my example the default constructor of tel_num, if any, should be=20
> called.=20
> > Otherwise the member is left uninitialized. But this is not a weak poin=
t=20
> of=20
> > my idea. Its the normal behaviour of the default constructor.=20
> >=20
> > Am Donnerstag, 31. M=C3=A4rz 2016 19:23:50 UTC+2 schrieb Johannes Schau=
b:=20
> >>=20
> >> I would not require putting explicit before each and every member. You=
=20
> >> have left it out of "TelNum", but what does that mean? Will the=20
> >> constructor leave the member with an uninitialized value? IMO that's=
=20
> >> bad because it will make "Person{a, b, c}" leave tel_num=20
> >> uninitialized, while initializing it when you remove all the=20
> >> "explicit" keywords.=20
> >>=20
> >> IMO this thing is a property of the class: You want to allow or forbid=
=20
> >> elision of initializers. Status quo is that "Person{name}" is allowed,=
=20
> >> and initialize the remaining three using default values=20
> >> (zero/null/=3D.../etc). I'm proposing to forbid this when you mark a=
=20
> >> class with a special way. Someone recommended something along the=20
> >> lines of "Person(a, b, c) =3D default;". I like that, but it requires=
=20
> >> repetition of names. You want to write a parameter list with meaning=
=20
> >> "all my members". Perhaps this would be viable, imitating the syntax=
=20
> >> of member function pointers and looking like a wildcard operator on=20
> >> A's scope:=20
> >>=20
> >>     A(A::*) =3D default;=20
> >>=20
> >> Defaulting this "Aggregate constructor" would make a A{...} use this=
=20
> >> ctor and using normal function semantics forbid leaving out members.=
=20
> >>=20
> >> 2016-03-30 22:31 GMT+02:00  <ma.ka...@web.de>:=20
> >> > Hi Community,=20
> >> >=20
> >> > I had an idea about explicit member variables. Explicit means, that=
=20
> they=20
> >> > have to be explicitly passed as parameters to the default=20
> constructor.=20
> >> >=20
> >> > class Person=20
> >> > {=20
> >> >     explicit string first_name;    // explicit=20
> >> >     explicit string last_name;     // explicit=20
> >> >     explicit unsigned age =3D 0;     // optional with default value=
=20
> >> >     TelNum tel_num;                // implicit=20
> >> > };=20
> >> >=20
> >> > This will generate a default constructor of the form=20
> >> >=20
> >> > Person::Person(string first_name, string last_name, unsigned age =3D=
=20
> 0);=20
> >> >=20
> >> > What do you think?=20
> >> >=20
> >> > Best Regards=20
> >> >=20
>

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/03223910-e8d5-49bb-8255-9112631b426a%40isocpp.or=
g.

------=_Part_591_1344341972.1459454565146
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Afte some research I think the best option is, that the ty=
pe loose its state as POD if there is at least one require. What do you thi=
nk about this solution?<br><br>Am Donnerstag, 31. M=C3=A4rz 2016 19:54:14 U=
TC+2 schrieb Johannes Schaub:<blockquote class=3D"gmail_quote" style=3D"mar=
gin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">I=
t&#39;s the normal behavior of the default constructor, but not the
<br>normal behavior of an absent constructor + using () or {} to create
<br>the object.
<br>
<br>struct A { int x, y; };
<br>A().x =3D=3D 0; // OK
<br>
<br>But
<br>
<br>struct A { A() { } int x, y; };
<br>A().x =3D=3D 0; // undefined behavior.
<br>
<br>Therefore, I would expect that in your code, it&#39;s an error to make
<br>tel_num implicit, to be on the safe side.
<br>
<br>2016-03-31 19:34 GMT+02:00 =C2=A0&lt;<a href=3D"javascript:" target=3D"=
_blank" gdf-obfuscated-mailto=3D"klxCuwwtAAAJ" rel=3D"nofollow" onmousedown=
=3D"this.href=3D&#39;javascript:&#39;;return true;" onclick=3D"this.href=3D=
&#39;javascript:&#39;;return true;">ma.ka...@web.de</a>&gt;:
<br>&gt; In my example the default constructor of tel_num, if any, should b=
e called.
<br>&gt; Otherwise the member is left uninitialized. But this is not a weak=
 point of
<br>&gt; my idea. Its the normal behaviour of the default constructor.
<br>&gt;
<br>&gt; Am Donnerstag, 31. M=C3=A4rz 2016 19:23:50 UTC+2 schrieb Johannes =
Schaub:
<br>&gt;&gt;
<br>&gt;&gt; I would not require putting explicit before each and every mem=
ber. You
<br>&gt;&gt; have left it out of &quot;TelNum&quot;, but what does that mea=
n? Will the
<br>&gt;&gt; constructor leave the member with an uninitialized value? IMO =
that&#39;s
<br>&gt;&gt; bad because it will make &quot;Person{a, b, c}&quot; leave tel=
_num
<br>&gt;&gt; uninitialized, while initializing it when you remove all the
<br>&gt;&gt; &quot;explicit&quot; keywords.
<br>&gt;&gt;
<br>&gt;&gt; IMO this thing is a property of the class: You want to allow o=
r forbid
<br>&gt;&gt; elision of initializers. Status quo is that &quot;Person{name}=
&quot; is allowed,
<br>&gt;&gt; and initialize the remaining three using default values
<br>&gt;&gt; (zero/null/=3D.../etc). I&#39;m proposing to forbid this when =
you mark a
<br>&gt;&gt; class with a special way. Someone recommended something along =
the
<br>&gt;&gt; lines of &quot;Person(a, b, c) =3D default;&quot;. I like that=
, but it requires
<br>&gt;&gt; repetition of names. You want to write a parameter list with m=
eaning
<br>&gt;&gt; &quot;all my members&quot;. Perhaps this would be viable, imit=
ating the syntax
<br>&gt;&gt; of member function pointers and looking like a wildcard operat=
or on
<br>&gt;&gt; A&#39;s scope:
<br>&gt;&gt;
<br>&gt;&gt; =C2=A0 =C2=A0 A(A::*) =3D default;
<br>&gt;&gt;
<br>&gt;&gt; Defaulting this &quot;Aggregate constructor&quot; would make a=
 A{...} use this
<br>&gt;&gt; ctor and using normal function semantics forbid leaving out me=
mbers.
<br>&gt;&gt;
<br>&gt;&gt; 2016-03-30 22:31 GMT+02:00 =C2=A0&lt;<a>ma.ka...@web.de</a>&gt=
;:
<br>&gt;&gt; &gt; Hi Community,
<br>&gt;&gt; &gt;
<br>&gt;&gt; &gt; I had an idea about explicit member variables. Explicit m=
eans, that they
<br>&gt;&gt; &gt; have to be explicitly passed as parameters to the default=
 constructor.
<br>&gt;&gt; &gt;
<br>&gt;&gt; &gt; class Person
<br>&gt;&gt; &gt; {
<br>&gt;&gt; &gt; =C2=A0 =C2=A0 explicit string first_name; =C2=A0 =C2=A0//=
 explicit
<br>&gt;&gt; &gt; =C2=A0 =C2=A0 explicit string last_name; =C2=A0 =C2=A0 //=
 explicit
<br>&gt;&gt; &gt; =C2=A0 =C2=A0 explicit unsigned age =3D 0; =C2=A0 =C2=A0 =
// optional with default value
<br>&gt;&gt; &gt; =C2=A0 =C2=A0 TelNum tel_num; =C2=A0 =C2=A0 =C2=A0 =C2=A0=
 =C2=A0 =C2=A0 =C2=A0 =C2=A0// implicit
<br>&gt;&gt; &gt; };
<br>&gt;&gt; &gt;
<br>&gt;&gt; &gt; This will generate a default constructor of the form
<br>&gt;&gt; &gt;
<br>&gt;&gt; &gt; Person::Person(string first_name, string last_name, unsig=
ned age =3D 0);
<br>&gt;&gt; &gt;
<br>&gt;&gt; &gt; What do you think?
<br>&gt;&gt; &gt;
<br>&gt;&gt; &gt; Best Regards
<br>&gt;&gt; &gt;
<br></blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/03223910-e8d5-49bb-8255-9112631b426a%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/03223910-e8d5-49bb-8255-9112631b426a=
%40isocpp.org</a>.<br />

------=_Part_591_1344341972.1459454565146--
------=_Part_590_1974436587.1459454565145--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Thu, 31 Mar 2016 16:23:21 -0700 (PDT)
Raw View
------=_Part_144_680935954.1459466601566
Content-Type: multipart/alternative;
 boundary="----=_Part_145_1356104218.1459466601566"

------=_Part_145_1356104218.1459466601566
Content-Type: text/plain; charset=UTF-8

On Thursday, March 31, 2016 at 1:28:54 PM UTC-4, ma.ka...@web.de wrote:
>
> There are two reasons for this proposal,
>
> - The first one is to reduce redundancy. While writing the constructor
> yourself, you have to repeat the member names 3 times. Once in de parameter
> list. And two times in the initialization list.
> You write down the variable names 4 times. If you separate declaration and
> definition it's even 5 times.
>

Which would only matter for objects that have a 1:1 correspondence between
constructor parameters and data members, and only for objects where there
is *no other initialization* besides the state of members.

We have a term for such objects: aggregates. Such objects *clearly* should
not have a constructor to begin with.

- The second one is to enforce initialization by the user without loosing
> simplicity of the class/struct. This is strongly related to the first point
> but worth to mention it separately.
>

I don't understand what business it is of yours if I initialize everything
in an aggregate or not. You deliberately wrote the type to be an aggregate.
That was your choice. By making that choice, you allow me to choose whether
or not to initialize any member of that aggregate. I get to provide those
values at a place and time of my choosing, not of yours.

If I want to default initialize it, then initialize various submembers from
arbitrary stuff, that's my prerogative. The writer of an aggregate should
*not* have the power to tell me how to go about initializing it. That's why
non-aggregates exist.

--
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/b8a55060-062d-4150-bcea-7d7947ac70b5%40isocpp.org.

------=_Part_145_1356104218.1459466601566
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Thursday, March 31, 2016 at 1:28:54 PM UTC-4, ma.ka...@=
web.de wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-le=
ft: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">=
There are two reasons for this proposal,<div><br></div><div>- The first one=
 is to reduce redundancy. While writing the constructor yourself, you have =
to repeat the member names 3 times. Once in de parameter list. And two time=
s in the initialization list.</div><div>You write down the variable names 4=
 times. If you separate declaration and definition it&#39;s even 5 times.</=
div></div></blockquote><div><br>Which would only matter for objects that ha=
ve a 1:1 correspondence between constructor parameters and data members, an=
d only for objects where there is <i>no other initialization</i> besides th=
e state of members.<br><br>We have a term for such objects: aggregates. Suc=
h objects <i>clearly</i> should not have a constructor to begin with.<br><b=
r></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>- The second one is to enforce initialization by the user withou=
t loosing simplicity of the class/struct. This is strongly related to the f=
irst point but worth to mention it separately.</div></div></blockquote><br>=
I don&#39;t understand what business it is of yours if I initialize everyth=
ing in an aggregate or not. You deliberately wrote the type to be an aggreg=
ate. That was your choice. By making that choice, you allow me to choose wh=
ether or not to initialize any member of that aggregate. I get to provide t=
hose values at a place and time of my choosing, not of yours.<br><br>If I w=
ant to default initialize it, then initialize various submembers from arbit=
rary stuff, that&#39;s my prerogative. The writer of an aggregate should <i=
>not</i> have the power to tell me how to go about initializing it. That&#3=
9;s why non-aggregates exist.<br></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/b8a55060-062d-4150-bcea-7d7947ac70b5%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/b8a55060-062d-4150-bcea-7d7947ac70b5=
%40isocpp.org</a>.<br />

------=_Part_145_1356104218.1459466601566--
------=_Part_144_680935954.1459466601566--

.


Author: "Arthur O'Dwyer" <arthur.j.odwyer@gmail.com>
Date: Thu, 31 Mar 2016 17:29:07 -0700
Raw View
--001a113ce79e8b1be4052f6177e1
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

On Thu, Mar 31, 2016 at 10:23 AM, Johannes Schaub wrote:
> You want to write a parameter list with meaning
> "all my members". Perhaps this would be viable, imitating the syntax
> of member function pointers and looking like a wildcard operator on
> A's scope:
>
>     A(A::*) =3D default;

I haven't kept up with the work on compile-time reflection, but it seems to
me that this could work, given the right reflection tools. For example,
assuming the existence of a metafunction nsdms<T> that returns some
compile-time representation of all the Non-Static Data Members of T, you
might have something like

    template<class... T>
    Person(T&&... t) :
        Person(std::make_index_sequence<sizeof...(T)>, t...) {}

    template<size_t... I>
    Person(std::index_sequence<I...>, nsdms<Person>::member<I>::type... t)
    {
        ( (this->*nsdms<Person>::member<I>::member_pointer) =3D std::move(t=
)
), ...;
    }

Then you'd CRTP that, or something... well, okay, this idea of mine is even
dumber than Martin's original one. :)

The real answer is "if you want a struct, use a struct; and if you
absolutely have to write Java in C++ for job-security reasons, you should
invest in a better IDE."

=E2=80=93Arthur

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/CADvuK0KbLEQ3PkLgKKi5iP4EKd9Umk35LgptEHBVes3J2Gd=
RDQ%40mail.gmail.com.

--001a113ce79e8b1be4052f6177e1
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Thu, Mar 31, 2016 at 10:23 AM, Johannes Schaub wrote:<b=
r>&gt;=C2=A0You want to write a parameter list with meaning<br>&gt; &quot;a=
ll my members&quot;. Perhaps this would be viable, imitating the syntax<br>=
&gt; of member function pointers and looking like a wildcard operator on<br=
>&gt; A&#39;s scope:<br>&gt;<br>&gt; =C2=A0 =C2=A0 A(A::*) =3D default;<br>=
<br>I haven&#39;t kept up with the work on compile-time reflection, but it =
seems to me that this could work, given the right reflection tools. For exa=
mple, assuming the existence of a metafunction <font face=3D"monospace, mon=
ospace">nsdms&lt;T&gt;</font> that returns some compile-time representation=
 of all the Non-Static Data Members of T, you might have something like<div=
><br></div><div><font face=3D"monospace, monospace">=C2=A0 =C2=A0 template&=
lt;class... T&gt;</font></div><div><font face=3D"monospace, monospace">=C2=
=A0 =C2=A0 Person(T&amp;&amp;... t) :</font></div><div><font face=3D"monosp=
ace, monospace">=C2=A0 =C2=A0 =C2=A0 =C2=A0 Person(std::make_index_sequence=
&lt;sizeof...(T)&gt;, t...) {}</font></div><div><font face=3D"monospace, mo=
nospace"><br></font></div><div><font face=3D"monospace, monospace">=C2=A0 =
=C2=A0 template&lt;size_t... I&gt;</font></div><div><font face=3D"monospace=
, monospace">=C2=A0 =C2=A0 Person(std::index_sequence&lt;I...&gt;, nsdms&lt=
;Person&gt;::member&lt;I&gt;::type... t)</font></div><div><font face=3D"mon=
ospace, monospace">=C2=A0 =C2=A0 {</font></div><div><font face=3D"monospace=
, monospace">=C2=A0 =C2=A0 =C2=A0 =C2=A0 ( (this-&gt;*nsdms&lt;Person&gt;::=
member&lt;I&gt;::member_pointer) =3D std::move(t) ), ...;</font></div><div>=
<font face=3D"monospace, monospace">=C2=A0 =C2=A0 }</font><br><div><br></di=
v><div>Then you&#39;d CRTP that, or something... well, okay, this idea of m=
ine is even dumber than Martin&#39;s original one. :)</div><div><br></div><=
div>The real answer is &quot;if you want a struct, use a struct; and if you=
 absolutely have to write Java in C++ for job-security reasons, you should =
invest in a better IDE.&quot;</div><div><br></div><div>=E2=80=93Arthur</div=
></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/CADvuK0KbLEQ3PkLgKKi5iP4EKd9Umk35Lgpt=
EHBVes3J2GdRDQ%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CADvuK0KbLEQ3PkLg=
KKi5iP4EKd9Umk35LgptEHBVes3J2GdRDQ%40mail.gmail.com</a>.<br />

--001a113ce79e8b1be4052f6177e1--

.


Author: ma.kalbfuss@web.de
Date: Thu, 31 Mar 2016 23:38:31 -0700 (PDT)
Raw View
------=_Part_9245_1701319165.1459492711608
Content-Type: multipart/alternative;
 boundary="----=_Part_9246_2088279332.1459492711609"

------=_Part_9246_2088279332.1459492711609
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

Arthur O'Dwyer: We have a term for such objects: aggregates. Such objects=
=20
*clearly* should not have a constructor to begin with.

Why shouldn't they have a constructor. Could you explain?

Arthur O'Dwyer: If I want to default initialize it, then initialize various=
=20
submembers from arbitrary stuff, that's my prerogative. The writer of an=20
aggregate should *not* have the power to tell me how to go about=20
initializing it. That's why non-aggregates exist.

I have to disagree. If you don't want to initialize members of an aggregate=
=20
and if there initialization is mandatory for the algorithm to work=20
correctly and to produce predictable results, it shouldn't be up to you to=
=20
do so. This enforcement helps you to write save code. If that wouldn't be=
=20
true the following code would be wrong. But I can't see an error here.

class Person
{

public:

    Person(string first_name, string last_name, unsigned age =3D 0)
        : first_name{ first_name }
        , last_name{ last_name }
        , age{ age }
    {}

private:

    string first_name;
    string last_name;
    unsigned age;
};


Its like saying type checking is evil because it's up to me to decide which=
=20
type I want to pass into a function.

Am Freitag, 1. April 2016 02:29:08 UTC+2 schrieb Arthur O'Dwyer:
>
> On Thu, Mar 31, 2016 at 10:23 AM, Johannes Schaub wrote:
> > You want to write a parameter list with meaning
> > "all my members". Perhaps this would be viable, imitating the syntax
> > of member function pointers and looking like a wildcard operator on
> > A's scope:
> >
> >     A(A::*) =3D default;
>
> I haven't kept up with the work on compile-time reflection, but it seems=
=20
> to me that this could work, given the right reflection tools. For example=
,=20
> assuming the existence of a metafunction nsdms<T> that returns some=20
> compile-time representation of all the Non-Static Data Members of T, you=
=20
> might have something like
>
>     template<class... T>
>     Person(T&&... t) :
>         Person(std::make_index_sequence<sizeof...(T)>, t...) {}
>
>     template<size_t... I>
>     Person(std::index_sequence<I...>, nsdms<Person>::member<I>::type... t=
)
>     {
>         ( (this->*nsdms<Person>::member<I>::member_pointer) =3D std::move=
(t)=20
> ), ...;
>     }
>
> Then you'd CRTP that, or something... well, okay, this idea of mine is=20
> even dumber than Martin's original one. :)
>
> The real answer is "if you want a struct, use a struct; and if you=20
> absolutely have to write Java in C++ for job-security reasons, you should=
=20
> invest in a better IDE."
>
> =E2=80=93Arthur
>

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/507a0080-b5f7-4e65-8e86-64e8e7207800%40isocpp.or=
g.

------=_Part_9246_2088279332.1459492711609
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><span class=3D"_username"><span data-name=3D"Arthur O&#39;=
Dwyer" data-userid=3D"114256375634250461400" style=3D"color: rgb(34, 34, 34=
);" class=3D"IVILX2C-D-a g-hovercard">Arthur O&#39;Dwyer: </span></span>We =
have a term for such objects: aggregates. Such objects <i>clearly</i> shoul=
d not have a constructor to begin with.<br><br>Why shouldn&#39;t they have =
a constructor. Could you explain?<br><br><span class=3D"_username"><span da=
ta-name=3D"Arthur O&#39;Dwyer" data-userid=3D"114256375634250461400" style=
=3D"color: rgb(34, 34, 34);" class=3D"IVILX2C-D-a g-hovercard">Arthur O&#39=
;Dwyer: </span></span>If I want to default initialize it, then initialize v=
arious submembers=20
from arbitrary stuff, that&#39;s my prerogative. The writer of an aggregate=
=20
should <i>not</i> have the power to tell me how to go about initializing it=
.. That&#39;s why non-aggregates exist.<br><br>I have to disagree. If you do=
n&#39;t want to initialize members of an aggregate and if there initializat=
ion is mandatory for the algorithm to work correctly and to produce predict=
able results, it shouldn&#39;t be up to you to do so. This enforcement help=
s you to write save code. If that wouldn&#39;t be true the following code w=
ould be wrong. But I can&#39;t see an error here.<br><br><div class=3D"pret=
typrint" style=3D"background-color: rgb(250, 250, 250); border-color: rgb(1=
87, 187, 187); border-style: solid; border-width: 1px; word-wrap: break-wor=
d;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=
=3D"color: #008;" class=3D"styled-by-prettify">class</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #60=
6;" class=3D"styled-by-prettify">Person</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br><br></span><span style=3D"color: #008;" class=3D"styled-=
by-prettify">public</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">:</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
<br><br>=C2=A0 =C2=A0 </span><span style=3D"color: #606;" class=3D"styled-b=
y-prettify">Person</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">(</span><span style=3D"color: #008;" class=3D"styled-by-prettify">s=
tring</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> firs=
t_name</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span=
 style=3D"color: #008;" class=3D"styled-by-prettify">string</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> last_name</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;=
" class=3D"styled-by-prettify">unsigned</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> age </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #066;" class=3D"styled-by-pr=
ettify">0</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0=
 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">:</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> first_name</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> firs=
t_name </span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> last_name</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> last_n=
ame </span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
age</span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> age </span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">{}</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br><br></span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">private</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">:</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"><br><br>=C2=A0 =C2=A0 </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">string</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> first_name</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"=
color: #008;" class=3D"styled-by-prettify">string</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> last_name</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">unsigned</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> age</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"><br></span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">};</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"><br></span></div></code></div><br><br>Its like saying type checking =
is evil because it&#39;s up to me to decide which type I want to pass into =
a function.<br><br>Am Freitag, 1. April 2016 02:29:08 UTC+2 schrieb Arthur =
O&#39;Dwyer:<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">O=
n Thu, Mar 31, 2016 at 10:23 AM, Johannes Schaub wrote:<br>&gt;=C2=A0You wa=
nt to write a parameter list with meaning<br>&gt; &quot;all my members&quot=
;. Perhaps this would be viable, imitating the syntax<br>&gt; of member fun=
ction pointers and looking like a wildcard operator on<br>&gt; A&#39;s scop=
e:<br>&gt;<br>&gt; =C2=A0 =C2=A0 A(A::*) =3D default;<br><br>I haven&#39;t =
kept up with the work on compile-time reflection, but it seems to me that t=
his could work, given the right reflection tools. For example, assuming the=
 existence of a metafunction <font face=3D"monospace, monospace">nsdms&lt;T=
&gt;</font> that returns some compile-time representation of all the Non-St=
atic Data Members of T, you might have something like<div><br></div><div><f=
ont face=3D"monospace, monospace">=C2=A0 =C2=A0 template&lt;class... T&gt;<=
/font></div><div><font face=3D"monospace, monospace">=C2=A0 =C2=A0 Person(T=
&amp;&amp;... t) :</font></div><div><font face=3D"monospace, monospace">=C2=
=A0 =C2=A0 =C2=A0 =C2=A0 Person(std::make_index_<wbr>sequence&lt;sizeof...(=
T)&gt;, t...) {}</font></div><div><font face=3D"monospace, monospace"><br><=
/font></div><div><font face=3D"monospace, monospace">=C2=A0 =C2=A0 template=
&lt;size_t... I&gt;</font></div><div><font face=3D"monospace, monospace">=
=C2=A0 =C2=A0 Person(std::index_sequence&lt;I..<wbr>.&gt;, nsdms&lt;Person&=
gt;::member&lt;I&gt;::<wbr>type... t)</font></div><div><font face=3D"monosp=
ace, monospace">=C2=A0 =C2=A0 {</font></div><div><font face=3D"monospace, m=
onospace">=C2=A0 =C2=A0 =C2=A0 =C2=A0 ( (this-&gt;*nsdms&lt;Person&gt;::mem=
ber&lt;<wbr>I&gt;::member_pointer) =3D std::move(t) ), ...;</font></div><di=
v><font face=3D"monospace, monospace">=C2=A0 =C2=A0 }</font><br><div><br></=
div><div>Then you&#39;d CRTP that, or something... well, okay, this idea of=
 mine is even dumber than Martin&#39;s original one. :)</div><div><br></div=
><div>The real answer is &quot;if you want a struct, use a struct; and if y=
ou absolutely have to write Java in C++ for job-security reasons, you shoul=
d invest in a better IDE.&quot;</div><div><br></div><div>=E2=80=93Arthur</d=
iv></div></div>
</blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/507a0080-b5f7-4e65-8e86-64e8e7207800%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/507a0080-b5f7-4e65-8e86-64e8e7207800=
%40isocpp.org</a>.<br />

------=_Part_9246_2088279332.1459492711609--
------=_Part_9245_1701319165.1459492711608--

.


Author: ma.kalbfuss@web.de
Date: Fri, 1 Apr 2016 00:13:24 -0700 (PDT)
Raw View
------=_Part_13_1414870154.1459494804352
Content-Type: multipart/alternative;
 boundary="----=_Part_14_1743308090.1459494804352"

------=_Part_14_1743308090.1459494804352
Content-Type: text/plain; charset=UTF-8

Sorry my citations in the last post where wrong. It was Nicol Bolas saying
that. Not
Arthur O'Dwyer. Sorry Arthur.


Nicol Bolas: Which would only matter for objects that have a 1:1
correspondence between constructor parameters and data members.

My idea includes the possibility to require only some members. Sure, the
numbers of my calculation are not true for such a case. But the problem
still remains.

Nicol Bolas:

Nicol Bolas: and only for objects where there is *no other initialization*
besides the state of members.

Yes. That's it. The idea is to extend the possibilities of the default
constructor to include this case.


Which would only matter for objects that have a 1:1 correspondence between
constructor parameters and data members


Am Freitag, 1. April 2016 01:23:21 UTC+2 schrieb Nicol Bolas:
>
> On Thursday, March 31, 2016 at 1:28:54 PM UTC-4, ma.ka...@web.de wrote:
>>
>> There are two reasons for this proposal,
>>
>> - The first one is to reduce redundancy. While writing the constructor
>> yourself, you have to repeat the member names 3 times. Once in de parameter
>> list. And two times in the initialization list.
>> You write down the variable names 4 times. If you separate declaration
>> and definition it's even 5 times.
>>
>
> Which would only matter for objects that have a 1:1 correspondence between
> constructor parameters and data members, and only for objects where there
> is *no other initialization* besides the state of members.
>
> We have a term for such objects: aggregates. Such objects *clearly*
> should not have a constructor to begin with.
>
> - The second one is to enforce initialization by the user without loosing
>> simplicity of the class/struct. This is strongly related to the first point
>> but worth to mention it separately.
>>
>
> I don't understand what business it is of yours if I initialize everything
> in an aggregate or not. You deliberately wrote the type to be an aggregate.
> That was your choice. By making that choice, you allow me to choose whether
> or not to initialize any member of that aggregate. I get to provide those
> values at a place and time of my choosing, not of yours.
>
> If I want to default initialize it, then initialize various submembers
> from arbitrary stuff, that's my prerogative. The writer of an aggregate
> should *not* have the power to tell me how to go about initializing it.
> That's why non-aggregates exist.
>

--
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/e40d586d-0b5a-4002-a1d2-718693df1bbe%40isocpp.org.

------=_Part_14_1743308090.1459494804352
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Sorry my citations in the last post where wrong. It was Ni=
col Bolas saying that. Not <span class=3D"IVILX2C-tb-gb"><div role=3D"butto=
n" class=3D"IVILX2C-H-d" tabindex=3D"0"><span></span></div></span> <span ro=
le=3D"gridcell"> <span class=3D"_username"><span data-name=3D"Arthur O&#39;=
Dwyer" data-userid=3D"114256375634250461400" style=3D"color: rgb(34, 34, 34=
);" class=3D"IVILX2C-D-a g-hovercard">Arthur O&#39;Dwyer. Sorry Arthur.</sp=
an></span></span><br><br><br><span class=3D"_username"><span style=3D"color=
: rgb(34, 34, 34);" class=3D"IVILX2C-D-a">Nicol Bolas: </span></span>Which =
would only matter for objects that have a 1:1 correspondence between constr=
uctor parameters and data members.<br><br>My idea includes the possibility =
to require only some members. Sure, the numbers of my calculation are not t=
rue for such a case. But the problem still remains.<br><br>Nicol Bolas: <br=
><br><span class=3D"_username"><span style=3D"color: rgb(34, 34, 34);" clas=
s=3D"IVILX2C-D-a">Nicol Bolas: </span></span>and only for objects where the=
re is <i>no other initialization</i> besides the state of members.<br><br>Y=
es. That&#39;s it. The idea is to extend the possibilities of the default c=
onstructor to include this case.<br><br><br>Which would only matter for obj=
ects that have a 1:1 correspondence between constructor parameters and data=
 members<br><br><br>Am Freitag, 1. April 2016 01:23:21 UTC+2 schrieb Nicol =
Bolas:<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">On Thur=
sday, March 31, 2016 at 1:28:54 PM UTC-4, <a>ma.ka...@web.de</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">There are two reasons =
for this proposal,<div><br></div><div>- The first one is to reduce redundan=
cy. While writing the constructor yourself, you have to repeat the member n=
ames 3 times. Once in de parameter list. And two times in the initializatio=
n list.</div><div>You write down the variable names 4 times. If you separat=
e declaration and definition it&#39;s even 5 times.</div></div></blockquote=
><div><br>Which would only matter for objects that have a 1:1 correspondenc=
e between constructor parameters and data members, and only for objects whe=
re there is <i>no other initialization</i> besides the state of members.<br=
><br>We have a term for such objects: aggregates. Such objects <i>clearly</=
i> should not have a constructor to begin with.<br><br></div><blockquote cl=
ass=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>- The second one=
 is to enforce initialization by the user without loosing simplicity of the=
 class/struct. This is strongly related to the first point but worth to men=
tion it separately.</div></div></blockquote><br>I don&#39;t understand what=
 business it is of yours if I initialize everything in an aggregate or not.=
 You deliberately wrote the type to be an aggregate. That was your choice. =
By making that choice, you allow me to choose whether or not to initialize =
any member of that aggregate. I get to provide those values at a place and =
time of my choosing, not of yours.<br><br>If I want to default initialize i=
t, then initialize various submembers from arbitrary stuff, that&#39;s my p=
rerogative. The writer of an aggregate should <i>not</i> have the power to =
tell me how to go about initializing it. That&#39;s why non-aggregates exis=
t.<br></div></blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/e40d586d-0b5a-4002-a1d2-718693df1bbe%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/e40d586d-0b5a-4002-a1d2-718693df1bbe=
%40isocpp.org</a>.<br />

------=_Part_14_1743308090.1459494804352--
------=_Part_13_1414870154.1459494804352--

.


Author: Nicol Bolas <jmckesson@gmail.com>
Date: Fri, 1 Apr 2016 10:00:36 -0700 (PDT)
Raw View
------=_Part_8068_1036293974.1459530036546
Content-Type: multipart/alternative;
 boundary="----=_Part_8069_256170812.1459530036547"

------=_Part_8069_256170812.1459530036547
Content-Type: text/plain; charset=UTF-8

On Friday, April 1, 2016 at 3:13:24 AM UTC-4, ma.ka...@web.de wrote:
>
> Sorry my citations in the last post where wrong. It was Nicol Bolas saying
> that. Not
> Arthur O'Dwyer. Sorry Arthur.
>
>
> Nicol Bolas: Which would only matter for objects that have a 1:1
> correspondence between constructor parameters and data members.
>
> My idea includes the possibility to require only some members. Sure, the
> numbers of my calculation are not true for such a case. But the problem
> still remains.
>

And what happens to the rest of the members, the ones not declared
"explicit"?

After all, your feature creates a constructor that takes the explicit
members as parameters. That constructor still has to initialize every
member with some sort of value, regardless of whether it was marked with
`explicit`. How does the user provide those other members with values?

Your feature, as you have described it, only makes sense if you mark *all*
of the members.


> Nicol Bolas:
>
> Nicol Bolas: and only for objects where there is *no other initialization*
> besides the state of members.
>
> Yes. That's it. The idea is to extend the possibilities of the default
> constructor to include this case.
>

"Default constructor". You keep using that term. I dunna think it means
<http://en.cppreference.com/w/cpp/language/default_constructor> what you
think it means.

My point about the whole 1:1 thing is that it means that the idea has
limited utility. There are not a lot of non-aggregate objects who's only
invariant is "you have to put *something* in all of my data fields."
Usually, when you have a type with invariants, you need to either process
the given data into the form that you're storing it in, or verify that the
data given fits your invariants.

For other types, people nowadays just make aggregates and let users fill
them in as appropriate.

Your idea is only useful for people who are writing a 1:1 class. I do not
feel that this is a sufficiently common case to warrant a language feature.
Or to put it another way, it's not a problem worth solving.

Really though, a much better solution would simply be to have some kind of
standardized attribute that requires that any aggregate initialization of
an aggregate value-initialize each member. Perhaps [[no_default]] or
something. That would prevent you from just using `SomeType t;`. You would
have to use `SomeType t{...};` and every member would need to have an
initializer.

--
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/481104f4-9020-4421-908b-fd23fa04416c%40isocpp.org.

------=_Part_8069_256170812.1459530036547
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Friday, April 1, 2016 at 3:13:24 AM UTC-4, ma.ka...@web=
..de 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">Sor=
ry my citations in the last post where wrong. It was Nicol Bolas saying tha=
t. Not <span><div><span></span></div></span> <span> <span><span style=3D"co=
lor:rgb(34,34,34)">Arthur O&#39;Dwyer. Sorry Arthur.</span></span></span><b=
r><br><br><span><span style=3D"color:rgb(34,34,34)">Nicol Bolas: </span></s=
pan>Which would only matter for objects that have a 1:1 correspondence betw=
een constructor parameters and data members.<br><br>My idea includes the po=
ssibility to require only some members. Sure, the numbers of my calculation=
 are not true for such a case. But the problem still remains.<br></div></bl=
ockquote><div><br>And what happens to the rest of the members, the ones not=
 declared &quot;explicit&quot;?<br><br>After all, your feature creates a co=
nstructor that takes the explicit members as parameters. That constructor s=
till has to initialize every member with some sort of value, regardless of =
whether it was marked with `explicit`. How does the user provide those othe=
r members with values?<br><br>Your feature, as you have described it, only =
makes sense if you mark <i>all</i> of the members.<br>=C2=A0</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">Nicol Bolas: <br><br><=
span><span style=3D"color:rgb(34,34,34)">Nicol Bolas: </span></span>and onl=
y for objects where there is <i>no other initialization</i> besides the sta=
te of members.<br><br>Yes. That&#39;s it. The idea is to extend the possibi=
lities of the default constructor to include this case.<br></div></blockquo=
te><div><br>&quot;Default constructor&quot;. You keep using that term. I du=
nna think <a href=3D"http://en.cppreference.com/w/cpp/language/default_cons=
tructor">it means</a> what you think it means.<br><br>My point about the wh=
ole 1:1 thing is that it means that the idea has limited utility. There are=
 not a lot of non-aggregate objects who&#39;s only invariant is &quot;you h=
ave to put <i>something</i> in all of my data fields.&quot; Usually, when y=
ou have a type with invariants, you need to either process the given data i=
nto the form that you&#39;re storing it in, or verify that the data given f=
its your invariants.<br><br>For other types, people nowadays just make aggr=
egates and let users fill them in as appropriate.<br><br>Your idea is only =
useful for people who are writing a 1:1 class. I do not feel that this is a=
 sufficiently common case to warrant a language feature. Or to put it anoth=
er way, it&#39;s not a problem worth solving.<br><br>Really though, a much =
better solution would simply be to have some kind of standardized attribute=
 that requires that any aggregate initialization of an aggregate value-init=
ialize each member. Perhaps [[no_default]] or something. That would prevent=
 you from just using `SomeType t;`. You would have to use `SomeType t{...};=
` and every member would need to have an initializer.<br></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/481104f4-9020-4421-908b-fd23fa04416c%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/481104f4-9020-4421-908b-fd23fa04416c=
%40isocpp.org</a>.<br />

------=_Part_8069_256170812.1459530036547--
------=_Part_8068_1036293974.1459530036546--

.


Author: ma.kalbfuss@web.de
Date: Fri, 1 Apr 2016 14:20:38 -0700 (PDT)
Raw View
------=_Part_1119_1806279543.1459545638721
Content-Type: multipart/alternative;
 boundary="----=_Part_1120_2100194464.1459545638721"

------=_Part_1120_2100194464.1459545638721
Content-Type: text/plain; charset=UTF-8

Wait a minute isn't Nicol Bolas this super power dragon from magic the
gathering? :-)

Back on topic:


And what happens to the rest of the members, the ones not declared
"explicit"?

For the members wich aren't explcit/required, the created constructor
behaves like the default constructor. If they are primitive members, they
kept uninitialized as it is now. If they have a constructor, this
constructor is called. Primitive non required members can be initialized as
always. The type looses its status as POD-type. this way, the constructor
is always called.

class Person
{
    // automatically created constructor
    // Person(string first_name, string last_name, int age = 0);


    unsigned id = create_id();  // initialized with the return value of
create_id
    require string first_name;  // explicitly provided by the user
    require string last_name;   // explicitly provided by the user
    require unsigned age = 0;   // explicitly provided by the user or
default value
    TelNum tel_num;             // call of the default constructor

};







Am Freitag, 1. April 2016 19:00:36 UTC+2 schrieb Nicol Bolas:
>
> On Friday, April 1, 2016 at 3:13:24 AM UTC-4, ma.ka...@web.de wrote:
>>
>> Sorry my citations in the last post where wrong. It was Nicol Bolas
>> saying that. Not
>> Arthur O'Dwyer. Sorry Arthur.
>>
>>
>> Nicol Bolas: Which would only matter for objects that have a 1:1
>> correspondence between constructor parameters and data members.
>>
>> My idea includes the possibility to require only some members. Sure, the
>> numbers of my calculation are not true for such a case. But the problem
>> still remains.
>>
>
> And what happens to the rest of the members, the ones not declared
> "explicit"?
>
> After all, your feature creates a constructor that takes the explicit
> members as parameters. That constructor still has to initialize every
> member with some sort of value, regardless of whether it was marked with
> `explicit`. How does the user provide those other members with values?
>
> Your feature, as you have described it, only makes sense if you mark *all*
> of the members.
>
>
>> Nicol Bolas:
>>
>> Nicol Bolas: and only for objects where there is *no other
>> initialization* besides the state of members.
>>
>> Yes. That's it. The idea is to extend the possibilities of the default
>> constructor to include this case.
>>
>
> "Default constructor". You keep using that term. I dunna think it means
> <http://en.cppreference.com/w/cpp/language/default_constructor> what you
> think it means.
>
> My point about the whole 1:1 thing is that it means that the idea has
> limited utility. There are not a lot of non-aggregate objects who's only
> invariant is "you have to put *something* in all of my data fields."
> Usually, when you have a type with invariants, you need to either process
> the given data into the form that you're storing it in, or verify that the
> data given fits your invariants.
>
> For other types, people nowadays just make aggregates and let users fill
> them in as appropriate.
>
> Your idea is only useful for people who are writing a 1:1 class. I do not
> feel that this is a sufficiently common case to warrant a language feature.
> Or to put it another way, it's not a problem worth solving.
>
> Really though, a much better solution would simply be to have some kind of
> standardized attribute that requires that any aggregate initialization of
> an aggregate value-initialize each member. Perhaps [[no_default]] or
> something. That would prevent you from just using `SomeType t;`. You would
> have to use `SomeType t{...};` and every member would need to have an
> initializer.
>

--
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/a1e1ac7b-2a4c-4e22-8e7c-7522b41169fb%40isocpp.org.

------=_Part_1120_2100194464.1459545638721
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><span><span style=3D"color:rgb(34,34,34)">Wait a minute is=
n&#39;t Nicol Bolas this super power dragon from magic the gathering? :-)<b=
r><br>Back on topic:<br><br></span></span><br><span><span style=3D"color:rg=
b(34,34,34)">And what happens to the rest of the members, the ones not decl=
ared &quot;explicit&quot;?<br><br>For the members wich aren&#39;t explcit/r=
equired, the created constructor behaves like the default constructor. If t=
hey are primitive members, they kept uninitialized as it is now. If they ha=
ve a constructor, this constructor is called. Primitive non required member=
s can be initialized as always. The type looses its status as POD-type. thi=
s way, the constructor is always called.<br><br><div class=3D"prettyprint" =
style=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 187, =
187); border-style: solid; border-width: 1px; word-wrap: break-word;"><code=
 class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: =
#008;" class=3D"styled-by-prettify">class</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=
=3D"styled-by-prettify">Person</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"><br></span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #800;" class=3D"styled-=
by-prettify">// automatically created constructor</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=
=3D"color: #800;" class=3D"styled-by-prettify">// Person(string first_name,=
 string last_name, int age =3D 0);</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br><br></span><br><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><span><span style=3D"color:rgb(34,34,34)"><code c=
lass=3D"prettyprint"><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy">=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-pr=
ettify">unsigned</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> id </span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> create=
_id</span><span style=3D"color: #660;" class=3D"styled-by-prettify">();</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify">=C2=A0 // init=
ialized with the return value of create_id</span></code></span></span><br>=
=C2=A0=C2=A0=C2=A0 </span><span style=3D"color: #008;" class=3D"styled-by-p=
rettify">require</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">str=
ing</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> first_=
name</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> =C2=A0</span><=
span style=3D"color: #800;" class=3D"styled-by-prettify">// </span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify">explicitly provided by th=
e user<br>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=3D"styled=
-by-prettify">require</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify=
">string</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> l=
ast_name</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify">=C2=A0=C2=
=A0 </span><span style=3D"color: #000;" class=3D"styled-by-prettify"><span>=
<span style=3D"color:rgb(34,34,34)"><code class=3D"prettyprint"><span style=
=3D"color: #000;" class=3D"styled-by-prettify"></span><span style=3D"color:=
 #800;" class=3D"styled-by-prettify">// </span></code></span></span></span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"><span><span style=
=3D"color:rgb(34,34,34)"><code class=3D"prettyprint"><span style=3D"color: =
#800;" class=3D"styled-by-prettify"><span><span style=3D"color:rgb(34,34,34=
)"><code class=3D"prettyprint"><span style=3D"color: #000;" class=3D"styled=
-by-prettify">explicitly provided by the user</span></code></span></span></=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><=
/code></span></span>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">require</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">unsigned</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> age </span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <=
/span><span style=3D"color: #066;" class=3D"styled-by-prettify">0</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">=C2=A0=C2=A0 // </span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"><span><span style=3D"c=
olor:rgb(34,34,34)"><code class=3D"prettyprint"><span style=3D"color: #000;=
" class=3D"styled-by-prettify">explicitly provided by the user</span></code=
></span></span> or default value<br>=C2=A0 =C2=A0 </span><span style=3D"col=
or: #606;" class=3D"styled-by-prettify">TelNum</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> tel_num</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify">=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=
=C2=A0=C2=A0=C2=A0=C2=A0 // call of the default constructor<br></span><span=
 style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">};</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"><br></span></div></code></div><br><b=
r><br><br><br><br></span></span><br>Am Freitag, 1. April 2016 19:00:36 UTC+=
2 schrieb Nicol Bolas:<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 Friday, April 1, 2016 at 3:13:24 AM UTC-4, <a>ma.ka...@web.de</=
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">Sorry my =
citations in the last post where wrong. It was Nicol Bolas saying that. Not=
 <span><div><span></span></div></span> <span> <span><span style=3D"color:rg=
b(34,34,34)">Arthur O&#39;Dwyer. Sorry Arthur.</span></span></span><br><br>=
<br><span><span style=3D"color:rgb(34,34,34)">Nicol Bolas: </span></span>Wh=
ich would only matter for objects that have a 1:1 correspondence between co=
nstructor parameters and data members.<br><br>My idea includes the possibil=
ity to require only some members. Sure, the numbers of my calculation are n=
ot true for such a case. But the problem still remains.<br></div></blockquo=
te><div><br>And what happens to the rest of the members, the ones not decla=
red &quot;explicit&quot;?<br><br>After all, your feature creates a construc=
tor that takes the explicit members as parameters. That constructor still h=
as to initialize every member with some sort of value, regardless of whethe=
r it was marked with `explicit`. How does the user provide those other memb=
ers with values?<br><br>Your feature, as you have described it, only makes =
sense if you mark <i>all</i> of the members.<br>=C2=A0</div><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">Nicol Bolas: <br><br><span><span =
style=3D"color:rgb(34,34,34)">Nicol Bolas: </span></span>and only for objec=
ts where there is <i>no other initialization</i> besides the state of membe=
rs.<br><br>Yes. That&#39;s it. The idea is to extend the possibilities of t=
he default constructor to include this case.<br></div></blockquote><div><br=
>&quot;Default constructor&quot;. You keep using that term. I dunna think <=
a href=3D"http://en.cppreference.com/w/cpp/language/default_constructor" ta=
rget=3D"_blank" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;http://www=
..google.com/url?q\75http%3A%2F%2Fen.cppreference.com%2Fw%2Fcpp%2Flanguage%2=
Fdefault_constructor\46sa\75D\46sntz\0751\46usg\75AFQjCNGrxO9NcieE61bz-XtgS=
rewuxVXAA&#39;;return true;" onclick=3D"this.href=3D&#39;http://www.google.=
com/url?q\75http%3A%2F%2Fen.cppreference.com%2Fw%2Fcpp%2Flanguage%2Fdefault=
_constructor\46sa\75D\46sntz\0751\46usg\75AFQjCNGrxO9NcieE61bz-XtgSrewuxVXA=
A&#39;;return true;">it means</a> what you think it means.<br><br>My point =
about the whole 1:1 thing is that it means that the idea has limited utilit=
y. There are not a lot of non-aggregate objects who&#39;s only invariant is=
 &quot;you have to put <i>something</i> in all of my data fields.&quot; Usu=
ally, when you have a type with invariants, you need to either process the =
given data into the form that you&#39;re storing it in, or verify that the =
data given fits your invariants.<br><br>For other types, people nowadays ju=
st make aggregates and let users fill them in as appropriate.<br><br>Your i=
dea is only useful for people who are writing a 1:1 class. I do not feel th=
at this is a sufficiently common case to warrant a language feature. Or to =
put it another way, it&#39;s not a problem worth solving.<br><br>Really tho=
ugh, a much better solution would simply be to have some kind of standardiz=
ed attribute that requires that any aggregate initialization of an aggregat=
e value-initialize each member. Perhaps [[no_default]] or something. That w=
ould prevent you from just using `SomeType t;`. You would have to use `Some=
Type t{...};` and every member would need to have an initializer.<br></div>=
</div></blockquote></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/a1e1ac7b-2a4c-4e22-8e7c-7522b41169fb%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/a1e1ac7b-2a4c-4e22-8e7c-7522b41169fb=
%40isocpp.org</a>.<br />

------=_Part_1120_2100194464.1459545638721--
------=_Part_1119_1806279543.1459545638721--

.


Author: Chris Hallock <christopherhallock@gmail.com>
Date: Fri, 1 Apr 2016 19:18:52 -0700 (PDT)
Raw View
------=_Part_1020_984094988.1459563532300
Content-Type: multipart/alternative;
 boundary="----=_Part_1021_1199830163.1459563532300"

------=_Part_1021_1199830163.1459563532300
Content-Type: text/plain; charset=UTF-8

Using aggregate classes and aggregate initialization in combination with
compiler warnings such as -Wmissing-field-initializers *almost *does what
you want, except that -Wmissing-field-initializers doesn't warn when the
aggregate is itself default-initialized or is initialized with just () or {}
..

If that's not good enough, Magnus Fromreide once suggested
<https://groups.google.com/a/isocpp.org/d/msg/std-proposals/OOX3-TRnXZM/Y7WfU-KNbCEJ>
the following helper class that could be useful here:

struct require_initializer {
    template <class T> operator T () const; // no implementation!
};

You use it like so:

struct X {
    double a = require_initializer{};
    int    b = 5;
};

int main()
{
    X x1 = { 3.5, 20 };  // OK
    X x2 = { 3.5 };      // OK
    X x3;                // link error!
}

However, as was noted, this is not ideal in practice because the error only
occurs at link-time and the diagnostic doesn't point you to the offending
*braced-init-list*. You can make GCC fail at compile-time by adding an
__error__ attribute to the template, but the diagnostic still doesn't point
you to the offending code. A possible improvement might be having
require_initializer throw up some error at runtime for debug builds and be
undefined for release builds.

--
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/a9aa1902-2dec-43b7-9b07-3af14ea098c9%40isocpp.org.

------=_Part_1021_1199830163.1459563532300
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Using aggregate classes and aggregate initialization in co=
mbination with compiler warnings such as <span style=3D"font-family: courie=
r new,monospace;">-Wmissing-field-initializers</span> <i>almost </i>does wh=
at you want, except that <span style=3D"font-family: courier new,monospace;=
">-Wmissing-field-initializers</span> doesn&#39;t warn when the aggregate i=
s itself default-initialized or is initialized with just <span style=3D"fon=
t-family: courier new,monospace;">()</span> or <span style=3D"font-family: =
courier new,monospace;">{}</span>.<br><br>If that&#39;s not good enough, Ma=
gnus Fromreide <a href=3D"https://groups.google.com/a/isocpp.org/d/msg/std-=
proposals/OOX3-TRnXZM/Y7WfU-KNbCEJ">once suggested</a> the following helper=
 class that could be useful here:<br><br><div class=3D"prettyprint" style=
=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187);=
 border-style: solid; border-width: 1px; word-wrap: break-word;"><code clas=
s=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color: #008;=
" class=3D"styled-by-prettify">struct</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> require_initializer </span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color:=
 #008;" class=3D"styled-by-prettify">template</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">&lt;</span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">class</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> T</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">&gt;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">operator=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> T </span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">()</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">const</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> </span><span style=3D"color: #800;" class=3D"st=
yled-by-prettify">// no implementation!</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">};</span></div></code></div><br>You use it like so:=
<br><br><div class=3D"prettyprint" style=3D"background-color: rgb(250, 250,=
 250); border-color: rgb(187, 187, 187); border-style: solid; border-width:=
 1px; word-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"sub=
prettyprint"><span style=3D"color: #008;" class=3D"styled-by-prettify">stru=
ct</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> X </spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span=
><span style=3D"color: #008;" class=3D"styled-by-prettify">double</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> a </span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> require_initializer</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">{};</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 </span><span =
style=3D"color: #008;" class=3D"styled-by-prettify">int</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> =C2=A0 =C2=A0b </span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #066;" class=3D"styled-by-prettify">5</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"><br></span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">};</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"><br><br></span><span style=3D"color: #008;" class=3D"styled-by-pretti=
fy">int</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> ma=
in</span><span style=3D"color: #660;" class=3D"styled-by-prettify">()</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span=
 style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 X x1 </span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> </span><span style=3D"color: #066;" class=
=3D"styled-by-prettify">3.5</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span><span style=3D"color: #066;" class=3D"styled-by-prettify">2=
0</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">};</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> =C2=A0</span><span style=
=3D"color: #800;" class=3D"styled-by-prettify">// OK</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"><br>=C2=A0 =C2=A0 X x2 </span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"> </span><span style=3D"color: #066;" class=3D=
"styled-by-prettify">3.5</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">};</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
=C2=A0 =C2=A0 =C2=A0</span><span style=3D"color: #800;" class=3D"styled-by-=
prettify">// OK</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"><br>=C2=A0 =C2=A0 X x3</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0</span><spa=
n style=3D"color: #800;" class=3D"styled-by-prettify">// link error!</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">}</span></div></code></=
div><br>However, as was noted, this is not ideal in practice because the er=
ror only occurs at link-time and the diagnostic doesn&#39;t point you to th=
e offending <i>braced-init-list</i>. You can make GCC fail at compile-time =
by adding an <span style=3D"font-family: courier new,monospace;">__error__<=
/span> attribute to the template, but the diagnostic still doesn&#39;t poin=
t you to the offending code. A possible improvement might be having <span s=
tyle=3D"font-family: courier new,monospace;">require_initializer</span> thr=
ow up some error at runtime for debug builds and be undefined for release b=
uilds.<br></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/a9aa1902-2dec-43b7-9b07-3af14ea098c9%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/a9aa1902-2dec-43b7-9b07-3af14ea098c9=
%40isocpp.org</a>.<br />

------=_Part_1021_1199830163.1459563532300--
------=_Part_1020_984094988.1459563532300--

.


Author: Chris Hallock <christopherhallock@gmail.com>
Date: Fri, 1 Apr 2016 19:24:10 -0700 (PDT)
Raw View
------=_Part_1525_1089802688.1459563850273
Content-Type: multipart/alternative;
 boundary="----=_Part_1526_2074064773.1459563850274"

------=_Part_1526_2074064773.1459563850274
Content-Type: text/plain; charset=UTF-8


>
> A possible improvement might be having require_initializer throw up some
> error at runtime for debug builds and be undefined for release builds.
>

Correction: I meant require_initializer::operator T, not require_initializer
..

--
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/8fb10ecc-c711-403a-ae4b-ec1f0283a21d%40isocpp.org.

------=_Part_1526_2074064773.1459563850274
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><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">A possible improvement might be having <span style=3D"font-family:couri=
er new,monospace">require_initializer</span> throw up some error at runtime=
 for debug builds and be undefined for release builds.<br></div></blockquot=
e><div><br>Correction: I meant <span style=3D"font-family: courier new,mono=
space;">require_initializer::operator T</span>, not <span style=3D"font-fam=
ily: courier new,monospace;">require_initializer</span>.<span style=3D"font=
-family:courier new,monospace"></span></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/8fb10ecc-c711-403a-ae4b-ec1f0283a21d%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/8fb10ecc-c711-403a-ae4b-ec1f0283a21d=
%40isocpp.org</a>.<br />

------=_Part_1526_2074064773.1459563850274--
------=_Part_1525_1089802688.1459563850273--

.