Topic: Mini-proposal of class name omission in constructor?


Author: Andrew Tomazos <andrewtomazos@gmail.com>
Date: Fri, 12 Apr 2019 20:29:40 +1000
Raw View
--0000000000007d9755058652c8ad
Content-Type: text/plain; charset="UTF-8"

Each constructor declaration within a class definition of C requires the
repetition of the (injected) class name C.  I suspect this is redundant.
Couldn't we allow the C to be taken as implied, and permit it to be
omitted?  Likewise for destructor?

// TODAY
class C {
    C();
    C(int);
    ~C();
};

// PROPOSED
class C {
    ();
    (int);
    ~();
};

The motivation is simply to get rid of some DRY violations.

--
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/CAB%2B4KHJev5nTdPnFvAuZcAswjmPdiwNrVVROd9NbnNxFoEF7qw%40mail.gmail.com.

--0000000000007d9755058652c8ad
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Each constructor declaration within a class definition of =
C requires the repetition of the (injected) class name C.=C2=A0 I suspect t=
his is redundant.=C2=A0 Couldn&#39;t we allow the C to be taken as implied,=
 and permit it to be omitted?=C2=A0 Likewise for destructor?<div><br></div>=
<div>// TODAY</div><div>class C {</div><div>=C2=A0 =C2=A0 C();<br></div><di=
v>=C2=A0 =C2=A0 C(int);</div><div>=C2=A0 =C2=A0 ~C();</div><div>};<br></div=
><div><br></div><div>// PROPOSED</div><div><div>class C {</div><div>=C2=A0 =
=C2=A0 ();</div><div>=C2=A0 =C2=A0 (int);<br></div><div>=C2=A0 =C2=A0 ~();<=
/div><div>};</div><br class=3D"gmail-Apple-interchange-newline"></div><div>=
The motivation is simply to get rid of some DRY violations.</div><div><br><=
/div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals&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/CAB%2B4KHJev5nTdPnFvAuZcAswjmPdiwNrVV=
ROd9NbnNxFoEF7qw%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter">h=
ttps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAB%2B4KHJev5nT=
dPnFvAuZcAswjmPdiwNrVVROd9NbnNxFoEF7qw%40mail.gmail.com</a>.<br />

--0000000000007d9755058652c8ad--

.


Author: Bo Persson <bo@bo-persson.se>
Date: Fri, 12 Apr 2019 12:51:17 +0200
Raw View
On 2019-04-12 at 12:29, Andrew Tomazos wrote:
> Each constructor declaration within a class definition of C requires the=
=20
> repetition of the (injected) class name C.=C2=A0 I suspect this is=20
> redundant.=C2=A0 Couldn't we allow the C to be taken as implied, and perm=
it=20
> it to be omitted?=C2=A0 Likewise for destructor?
>=20
> // TODAY
> class C {
>  =C2=A0 =C2=A0 C();
>  =C2=A0 =C2=A0 C(int);
>  =C2=A0 =C2=A0 ~C();
> };
>=20
> // PROPOSED
> class C {
>  =C2=A0 =C2=A0 ();
>  =C2=A0 =C2=A0 (int);
>  =C2=A0 =C2=A0 ~();
> };
>=20
> The motivation is simply to get rid of some DRY violations.
>=20

That's not a DRY violation. C(int); means that you didn't intend to=20
write f(int);, so it is not really redundant.


    Bo Persson



--=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/q8pqj6%245qdm%241%40blaine.gmane.org.

.


Author: Andrew Tomazos <andrewtomazos@gmail.com>
Date: Fri, 12 Apr 2019 20:56:28 +1000
Raw View
--000000000000505a230586532839
Content-Type: text/plain; charset="UTF-8"

On Fri, Apr 12, 2019 at 8:55 PM Bo Persson <bo@bo-persson.se> wrote:

> On 2019-04-12 at 12:29, Andrew Tomazos wrote:
> > Each constructor declaration within a class definition of C requires the
> > repetition of the (injected) class name C.  I suspect this is
> > redundant.  Couldn't we allow the C to be taken as implied, and permit
> > it to be omitted?  Likewise for destructor?
> >
> > // TODAY
> > class C {
> >      C();
> >      C(int);
> >      ~C();
> > };
> >
> > // PROPOSED
> > class C {
> >      ();
> >      (int);
> >      ~();
> > };
> >
> > The motivation is simply to get rid of some DRY violations.
> >
>
> That's not a DRY violation. C(int); means that you didn't intend to
> write f(int);, so it is not really redundant.
>

Why can't (int); also mean that you didn't intend to write f(int); ?

--
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/CAB%2B4KHKww%2BR7qkLhNsdHc2cMhQrN2nhA%2B2Q_-zHddM25k_P6Tg%40mail.gmail.com.

--000000000000505a230586532839
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr">On Fri, Apr 12, 2019 at 8:55 PM Bo Persso=
n &lt;<a href=3D"mailto:bo@bo-persson.se">bo@bo-persson.se</a>&gt; wrote:<b=
r></div><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=
=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding=
-left:1ex">On 2019-04-12 at 12:29, Andrew Tomazos wrote:<br>
&gt; Each constructor declaration within a class definition of C requires t=
he <br>
&gt; repetition of the (injected) class name C.=C2=A0 I suspect this is <br=
>
&gt; redundant.=C2=A0 Couldn&#39;t we allow the C to be taken as implied, a=
nd permit <br>
&gt; it to be omitted?=C2=A0 Likewise for destructor?<br>
&gt; <br>
&gt; // TODAY<br>
&gt; class C {<br>
&gt;=C2=A0 =C2=A0 =C2=A0 C();<br>
&gt;=C2=A0 =C2=A0 =C2=A0 C(int);<br>
&gt;=C2=A0 =C2=A0 =C2=A0 ~C();<br>
&gt; };<br>
&gt; <br>
&gt; // PROPOSED<br>
&gt; class C {<br>
&gt;=C2=A0 =C2=A0 =C2=A0 ();<br>
&gt;=C2=A0 =C2=A0 =C2=A0 (int);<br>
&gt;=C2=A0 =C2=A0 =C2=A0 ~();<br>
&gt; };<br>
&gt; <br>
&gt; The motivation is simply to get rid of some DRY violations.<br>
&gt; <br>
<br>
That&#39;s not a DRY violation. C(int); means that you didn&#39;t intend to=
 <br>
write f(int);, so it is not really redundant.<br></blockquote><div><br></di=
v><div>Why can&#39;t (int); also mean that you didn&#39;t intend to write f=
(int); ?</div><div>=C2=A0</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/CAB%2B4KHKww%2BR7qkLhNsdHc2cMhQrN2nhA=
%2B2Q_-zHddM25k_P6Tg%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfoote=
r">https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAB%2B4KHKw=
w%2BR7qkLhNsdHc2cMhQrN2nhA%2B2Q_-zHddM25k_P6Tg%40mail.gmail.com</a>.<br />

--000000000000505a230586532839--

.


Author: Domen Vrankar <domen.vrankar@gmail.com>
Date: Fri, 12 Apr 2019 14:08:58 +0200
Raw View
--00000000000095e5530586542b8f
Content-Type: text/plain; charset="UTF-8"

On Fri, Apr 12, 2019, 12:56 Andrew Tomazos <andrewtomazos@gmail.com> wrote:

> On Fri, Apr 12, 2019 at 8:55 PM Bo Persson <bo@bo-persson.se> wrote:
>
>> On 2019-04-12 at 12:29, Andrew Tomazos wrote:
>> > Each constructor declaration within a class definition of C requires
>> the
>> > repetition of the (injected) class name C.  I suspect this is
>> > redundant.  Couldn't we allow the C to be taken as implied, and permit
>> > it to be omitted?  Likewise for destructor?
>> >
>> > // TODAY
>> > class C {
>> >      C();
>> >      C(int);
>> >      ~C();
>> > };
>> >
>> > // PROPOSED
>> > class C {
>> >      ();
>> >      (int);
>> >      ~();
>> > };
>> >
>> > The motivation is simply to get rid of some DRY violations.
>> >
>>
>> That's not a DRY violation. C(int); means that you didn't intend to
>> write f(int);, so it is not really redundant.
>>
>
> Why can't (int); also mean that you didn't intend to write f(int); ?
>

It could but there is also the issue of harder spotting it/searching for
constructors for those of us that use text editors/diff tools instead of
full blown IDEs.

Regards,
Domen

>

--
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/CAKgx6BKAipbuQo4nEiTJDLspDx3tBn%2B15pmOoFE_gi4t%2BZakyw%40mail.gmail.com.

--00000000000095e5530586542b8f
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto"><div class=3D"gmail_quote" dir=3D"auto"><div dir=3D"ltr" =
class=3D"gmail_attr">On Fri, Apr 12, 2019, 12:56 Andrew Tomazos &lt;<a href=
=3D"mailto:andrewtomazos@gmail.com">andrewtomazos@gmail.com</a>&gt; wrote:<=
br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;borde=
r-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr"><div dir=3D"ltr">O=
n Fri, Apr 12, 2019 at 8:55 PM Bo Persson &lt;<a href=3D"mailto:bo@bo-perss=
on.se" target=3D"_blank" rel=3D"noreferrer">bo@bo-persson.se</a>&gt; wrote:=
<br></div><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" styl=
e=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);paddin=
g-left:1ex">On 2019-04-12 at 12:29, Andrew Tomazos wrote:<br>
&gt; Each constructor declaration within a class definition of C requires t=
he <br>
&gt; repetition of the (injected) class name C.=C2=A0 I suspect this is <br=
>
&gt; redundant.=C2=A0 Couldn&#39;t we allow the C to be taken as implied, a=
nd permit <br>
&gt; it to be omitted?=C2=A0 Likewise for destructor?<br>
&gt; <br>
&gt; // TODAY<br>
&gt; class C {<br>
&gt;=C2=A0 =C2=A0 =C2=A0 C();<br>
&gt;=C2=A0 =C2=A0 =C2=A0 C(int);<br>
&gt;=C2=A0 =C2=A0 =C2=A0 ~C();<br>
&gt; };<br>
&gt; <br>
&gt; // PROPOSED<br>
&gt; class C {<br>
&gt;=C2=A0 =C2=A0 =C2=A0 ();<br>
&gt;=C2=A0 =C2=A0 =C2=A0 (int);<br>
&gt;=C2=A0 =C2=A0 =C2=A0 ~();<br>
&gt; };<br>
&gt; <br>
&gt; The motivation is simply to get rid of some DRY violations.<br>
&gt; <br>
<br>
That&#39;s not a DRY violation. C(int); means that you didn&#39;t intend to=
 <br>
write f(int);, so it is not really redundant.<br></blockquote><div><br></di=
v><div>Why can&#39;t (int); also mean that you didn&#39;t intend to write f=
(int); ?</div></div></div></blockquote></div><div dir=3D"auto"><br></div><d=
iv dir=3D"auto">It could but there is also the issue of harder spotting it/=
searching for constructors for those of us that use text editors/diff tools=
 instead of full blown IDEs.</div><div dir=3D"auto"><br></div><div dir=3D"a=
uto">Regards,</div><div dir=3D"auto">Domen</div><div class=3D"gmail_quote" =
dir=3D"auto"><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;b=
order-left:1px #ccc solid;padding-left:1ex">
</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/CAKgx6BKAipbuQo4nEiTJDLspDx3tBn%2B15p=
mOoFE_gi4t%2BZakyw%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAKgx6BKAipbu=
Qo4nEiTJDLspDx3tBn%2B15pmOoFE_gi4t%2BZakyw%40mail.gmail.com</a>.<br />

--00000000000095e5530586542b8f--

.


Author: Magnus Fromreide <magfr@lysator.liu.se>
Date: Sun, 14 Apr 2019 20:58:03 +0200
Raw View
On Fri, Apr 12, 2019 at 02:08:58PM +0200, Domen Vrankar wrote:
> On Fri, Apr 12, 2019, 12:56 Andrew Tomazos <andrewtomazos@gmail.com> wrote:
>
> > On Fri, Apr 12, 2019 at 8:55 PM Bo Persson <bo@bo-persson.se> wrote:
> >
> >> On 2019-04-12 at 12:29, Andrew Tomazos wrote:
> >> > Each constructor declaration within a class definition of C requires
> >> the
> >> > repetition of the (injected) class name C.  I suspect this is
> >> > redundant.  Couldn't we allow the C to be taken as implied, and permit
> >> > it to be omitted?  Likewise for destructor?
> >> >
> >> > // TODAY
> >> > class C {
> >> >      C();
> >> >      C(int);
> >> >      ~C();
> >> > };
> >> >
> >> > // PROPOSED
> >> > class C {
> >> >      ();
> >> >      (int);
> >> >      ~();
> >> > };
> >> >
> >> > The motivation is simply to get rid of some DRY violations.
> >> >
> >>
> >> That's not a DRY violation. C(int); means that you didn't intend to
> >> write f(int);, so it is not really redundant.
> >>
> >
> > Why can't (int); also mean that you didn't intend to write f(int); ?
> >
>
> It could but there is also the issue of harder spotting it/searching for
> constructors for those of us that use text editors/diff tools instead of
> full blown IDEs.

One advantage(?) of this proposal is that it allows constructors for anonymous
classes.

class {
 () : member() { /* something */ }
 ~() { /* something* / }
private:
 Foo member;
} variable;

/MF

> Regards,
> Domen
>
> >
>
> --
> 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/CAKgx6BKAipbuQo4nEiTJDLspDx3tBn%2B15pmOoFE_gi4t%2BZakyw%40mail.gmail.com.

--
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/20190414185803.GA3141%40noemi.bahnhof.se.

.


Author: Domen Vrankar <domen.vrankar@gmail.com>
Date: Mon, 15 Apr 2019 08:14:31 +0200
Raw View
--0000000000008884d305868b918c
Content-Type: text/plain; charset="UTF-8"

On Sun, Apr 14, 2019, 20:58 Magnus Fromreide <magfr@lysator.liu.se> wrote:

> On Fri, Apr 12, 2019 at 02:08:58PM +0200, Domen Vrankar wrote:
> > On Fri, Apr 12, 2019, 12:56 Andrew Tomazos <andrewtomazos@gmail.com>
> wrote:
> >
> > > On Fri, Apr 12, 2019 at 8:55 PM Bo Persson <bo@bo-persson.se> wrote:
> > >
> > >> On 2019-04-12 at 12:29, Andrew Tomazos wrote:
> > >> > Each constructor declaration within a class definition of C requires
> > >> the
> > >> > repetition of the (injected) class name C.  I suspect this is
> > >> > redundant.  Couldn't we allow the C to be taken as implied, and
> permit
> > >> > it to be omitted?  Likewise for destructor?
> > >> >
> > >> > // TODAY
> > >> > class C {
> > >> >      C();
> > >> >      C(int);
> > >> >      ~C();
> > >> > };
> > >> >
> > >> > // PROPOSED
> > >> > class C {
> > >> >      ();
> > >> >      (int);
> > >> >      ~();
> > >> > };
> > >> >
> > >> > The motivation is simply to get rid of some DRY violations.
> > >> >
> > >>
> > >> That's not a DRY violation. C(int); means that you didn't intend to
> > >> write f(int);, so it is not really redundant.
> > >>
> > >
> > > Why can't (int); also mean that you didn't intend to write f(int); ?
> > >
> >
> > It could but there is also the issue of harder spotting it/searching for
> > constructors for those of us that use text editors/diff tools instead of
> > full blown IDEs.
>
> One advantage(?) of this proposal is that it allows constructors for
> anonymous
> classes.
>
> class {
>         () : member() { /* something */ }
>         ~() { /* something* / }
> private:
>         Foo member;
> } variable;


I personaly don't see that as such an advantage that would be a compelling
reason to change the core language.
Lambda functions are already a terse syntax for when you don't require a
destructor.
And in combination with p0052 scope guards you also get the destructor part
- and such a templated class can allready be writen now in ~10 lines of
code, put inside a util header and then used everywhere you like.

Regards,
Domen

>

--
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/CAKgx6BKhpoXXgn6Np1UDb-w_Z8V%2B%2B8Dn7LE-Q4Gofte8pa4Jwg%40mail.gmail.com.

--0000000000008884d305868b918c
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto"><div><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D=
"gmail_attr">On Sun, Apr 14, 2019, 20:58 Magnus Fromreide &lt;<a href=3D"ma=
ilto:magfr@lysator.liu.se" target=3D"_blank" rel=3D"noreferrer">magfr@lysat=
or.liu.se</a>&gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=
=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Fri, =
Apr 12, 2019 at 02:08:58PM +0200, Domen Vrankar wrote:<br>
&gt; On Fri, Apr 12, 2019, 12:56 Andrew Tomazos &lt;<a href=3D"mailto:andre=
wtomazos@gmail.com" rel=3D"noreferrer noreferrer" target=3D"_blank">andrewt=
omazos@gmail.com</a>&gt; wrote:<br>
&gt; <br>
&gt; &gt; On Fri, Apr 12, 2019 at 8:55 PM Bo Persson &lt;<a href=3D"mailto:=
bo@bo-persson.se" rel=3D"noreferrer noreferrer" target=3D"_blank">bo@bo-per=
sson.se</a>&gt; wrote:<br>
&gt; &gt;<br>
&gt; &gt;&gt; On 2019-04-12 at 12:29, Andrew Tomazos wrote:<br>
&gt; &gt;&gt; &gt; Each constructor declaration within a class definition o=
f C requires<br>
&gt; &gt;&gt; the<br>
&gt; &gt;&gt; &gt; repetition of the (injected) class name C.=C2=A0 I suspe=
ct this is<br>
&gt; &gt;&gt; &gt; redundant.=C2=A0 Couldn&#39;t we allow the C to be taken=
 as implied, and permit<br>
&gt; &gt;&gt; &gt; it to be omitted?=C2=A0 Likewise for destructor?<br>
&gt; &gt;&gt; &gt;<br>
&gt; &gt;&gt; &gt; // TODAY<br>
&gt; &gt;&gt; &gt; class C {<br>
&gt; &gt;&gt; &gt;=C2=A0 =C2=A0 =C2=A0 C();<br>
&gt; &gt;&gt; &gt;=C2=A0 =C2=A0 =C2=A0 C(int);<br>
&gt; &gt;&gt; &gt;=C2=A0 =C2=A0 =C2=A0 ~C();<br>
&gt; &gt;&gt; &gt; };<br>
&gt; &gt;&gt; &gt;<br>
&gt; &gt;&gt; &gt; // PROPOSED<br>
&gt; &gt;&gt; &gt; class C {<br>
&gt; &gt;&gt; &gt;=C2=A0 =C2=A0 =C2=A0 ();<br>
&gt; &gt;&gt; &gt;=C2=A0 =C2=A0 =C2=A0 (int);<br>
&gt; &gt;&gt; &gt;=C2=A0 =C2=A0 =C2=A0 ~();<br>
&gt; &gt;&gt; &gt; };<br>
&gt; &gt;&gt; &gt;<br>
&gt; &gt;&gt; &gt; The motivation is simply to get rid of some DRY violatio=
ns.<br>
&gt; &gt;&gt; &gt;<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; That&#39;s not a DRY violation. C(int); means that you didn&#=
39;t intend to<br>
&gt; &gt;&gt; write f(int);, so it is not really redundant.<br>
&gt; &gt;&gt;<br>
&gt; &gt;<br>
&gt; &gt; Why can&#39;t (int); also mean that you didn&#39;t intend to writ=
e f(int); ?<br>
&gt; &gt;<br>
&gt; <br>
&gt; It could but there is also the issue of harder spotting it/searching f=
or<br>
&gt; constructors for those of us that use text editors/diff tools instead =
of<br>
&gt; full blown IDEs.<br>
<br>
One advantage(?) of this proposal is that it allows constructors for anonym=
ous<br>
classes.<br>
<br>
class {<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 () : member() { /* something */ }<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ~() { /* something* / }<br>
private:<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 Foo member;<br>
} variable;</blockquote></div></div><div dir=3D"auto"><br></div><div dir=3D=
"auto">I personaly don&#39;t see that as such an advantage that would be a =
compelling reason to change the core language.</div><div dir=3D"auto">Lambd=
a functions are already a terse syntax for when you don&#39;t require a des=
tructor.</div><div dir=3D"auto">And in combination with p0052 scope guards =
you also get the destructor part - and such a templated class can allready =
be writen now in ~10 lines of code, put inside a util header and then used =
everywhere you like.</div><div dir=3D"auto"></div><div dir=3D"auto"><br></d=
iv><div dir=3D"auto">Regards,</div><div dir=3D"auto">Domen</div><div dir=3D=
"auto"><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=
=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</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/CAKgx6BKhpoXXgn6Np1UDb-w_Z8V%2B%2B8Dn=
7LE-Q4Gofte8pa4Jwg%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfooter"=
>https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAKgx6BKhpoXX=
gn6Np1UDb-w_Z8V%2B%2B8Dn7LE-Q4Gofte8pa4Jwg%40mail.gmail.com</a>.<br />

--0000000000008884d305868b918c--

.


Author: Jake Arkinstall <jake.arkinstall@gmail.com>
Date: Mon, 15 Apr 2019 08:49:24 +0100
Raw View
--000000000000a7a31a05868ce435
Content-Type: text/plain; charset="UTF-8"

I'm okay with the idea of a generic constructor (though I'm far from
strongly opinioned either way) . I don't like the idea of leaving it blank
though. Python's __init__ and PHP's __construct are clear, and that's an
approach I'd rather. Internally, of course, it would just be relabelled
with the class name.


On Mon, 15 Apr 2019, 07:14 Domen Vrankar, <domen.vrankar@gmail.com> wrote:

> On Sun, Apr 14, 2019, 20:58 Magnus Fromreide <magfr@lysator.liu.se> wrote:
>
>> On Fri, Apr 12, 2019 at 02:08:58PM +0200, Domen Vrankar wrote:
>> > On Fri, Apr 12, 2019, 12:56 Andrew Tomazos <andrewtomazos@gmail.com>
>> wrote:
>> >
>> > > On Fri, Apr 12, 2019 at 8:55 PM Bo Persson <bo@bo-persson.se> wrote:
>> > >
>> > >> On 2019-04-12 at 12:29, Andrew Tomazos wrote:
>> > >> > Each constructor declaration within a class definition of C
>> requires
>> > >> the
>> > >> > repetition of the (injected) class name C.  I suspect this is
>> > >> > redundant.  Couldn't we allow the C to be taken as implied, and
>> permit
>> > >> > it to be omitted?  Likewise for destructor?
>> > >> >
>> > >> > // TODAY
>> > >> > class C {
>> > >> >      C();
>> > >> >      C(int);
>> > >> >      ~C();
>> > >> > };
>> > >> >
>> > >> > // PROPOSED
>> > >> > class C {
>> > >> >      ();
>> > >> >      (int);
>> > >> >      ~();
>> > >> > };
>> > >> >
>> > >> > The motivation is simply to get rid of some DRY violations.
>> > >> >
>> > >>
>> > >> That's not a DRY violation. C(int); means that you didn't intend to
>> > >> write f(int);, so it is not really redundant.
>> > >>
>> > >
>> > > Why can't (int); also mean that you didn't intend to write f(int); ?
>> > >
>> >
>> > It could but there is also the issue of harder spotting it/searching for
>> > constructors for those of us that use text editors/diff tools instead of
>> > full blown IDEs.
>>
>> One advantage(?) of this proposal is that it allows constructors for
>> anonymous
>> classes.
>>
>> class {
>>         () : member() { /* something */ }
>>         ~() { /* something* / }
>> private:
>>         Foo member;
>> } variable;
>
>
> I personaly don't see that as such an advantage that would be a compelling
> reason to change the core language.
> Lambda functions are already a terse syntax for when you don't require a
> destructor.
> And in combination with p0052 scope guards you also get the destructor
> part - and such a templated class can allready be writen now in ~10 lines
> of code, put inside a util header and then used everywhere you like.
>
> Regards,
> Domen
>
>> --
> 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/CAKgx6BKhpoXXgn6Np1UDb-w_Z8V%2B%2B8Dn7LE-Q4Gofte8pa4Jwg%40mail.gmail.com
> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAKgx6BKhpoXXgn6Np1UDb-w_Z8V%2B%2B8Dn7LE-Q4Gofte8pa4Jwg%40mail.gmail.com?utm_medium=email&utm_source=footer>
> .
>

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

--000000000000a7a31a05868ce435
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"auto">I&#39;m okay with the idea of a generic constructor (thou=
gh I&#39;m far from strongly opinioned either way) . I don&#39;t like the i=
dea of leaving it blank though. Python&#39;s __init__ and PHP&#39;s __const=
ruct are clear, and that&#39;s an approach I&#39;d rather. Internally, of c=
ourse, it would just be relabelled with the class name.<div dir=3D"auto"><b=
r></div></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmai=
l_attr">On Mon, 15 Apr 2019, 07:14 Domen Vrankar, &lt;<a href=3D"mailto:dom=
en.vrankar@gmail.com">domen.vrankar@gmail.com</a>&gt; wrote:<br></div><bloc=
kquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #cc=
c solid;padding-left:1ex"><div dir=3D"auto"><div><div class=3D"gmail_quote"=
><div dir=3D"ltr" class=3D"gmail_attr">On Sun, Apr 14, 2019, 20:58 Magnus F=
romreide &lt;<a href=3D"mailto:magfr@lysator.liu.se" rel=3D"noreferrer nore=
ferrer" target=3D"_blank">magfr@lysator.liu.se</a>&gt; wrote:<br></div><blo=
ckquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #c=
cc solid;padding-left:1ex">On Fri, Apr 12, 2019 at 02:08:58PM +0200, Domen =
Vrankar wrote:<br>
&gt; On Fri, Apr 12, 2019, 12:56 Andrew Tomazos &lt;<a href=3D"mailto:andre=
wtomazos@gmail.com" rel=3D"noreferrer noreferrer noreferrer" target=3D"_bla=
nk">andrewtomazos@gmail.com</a>&gt; wrote:<br>
&gt; <br>
&gt; &gt; On Fri, Apr 12, 2019 at 8:55 PM Bo Persson &lt;<a href=3D"mailto:=
bo@bo-persson.se" rel=3D"noreferrer noreferrer noreferrer" target=3D"_blank=
">bo@bo-persson.se</a>&gt; wrote:<br>
&gt; &gt;<br>
&gt; &gt;&gt; On 2019-04-12 at 12:29, Andrew Tomazos wrote:<br>
&gt; &gt;&gt; &gt; Each constructor declaration within a class definition o=
f C requires<br>
&gt; &gt;&gt; the<br>
&gt; &gt;&gt; &gt; repetition of the (injected) class name C.=C2=A0 I suspe=
ct this is<br>
&gt; &gt;&gt; &gt; redundant.=C2=A0 Couldn&#39;t we allow the C to be taken=
 as implied, and permit<br>
&gt; &gt;&gt; &gt; it to be omitted?=C2=A0 Likewise for destructor?<br>
&gt; &gt;&gt; &gt;<br>
&gt; &gt;&gt; &gt; // TODAY<br>
&gt; &gt;&gt; &gt; class C {<br>
&gt; &gt;&gt; &gt;=C2=A0 =C2=A0 =C2=A0 C();<br>
&gt; &gt;&gt; &gt;=C2=A0 =C2=A0 =C2=A0 C(int);<br>
&gt; &gt;&gt; &gt;=C2=A0 =C2=A0 =C2=A0 ~C();<br>
&gt; &gt;&gt; &gt; };<br>
&gt; &gt;&gt; &gt;<br>
&gt; &gt;&gt; &gt; // PROPOSED<br>
&gt; &gt;&gt; &gt; class C {<br>
&gt; &gt;&gt; &gt;=C2=A0 =C2=A0 =C2=A0 ();<br>
&gt; &gt;&gt; &gt;=C2=A0 =C2=A0 =C2=A0 (int);<br>
&gt; &gt;&gt; &gt;=C2=A0 =C2=A0 =C2=A0 ~();<br>
&gt; &gt;&gt; &gt; };<br>
&gt; &gt;&gt; &gt;<br>
&gt; &gt;&gt; &gt; The motivation is simply to get rid of some DRY violatio=
ns.<br>
&gt; &gt;&gt; &gt;<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; That&#39;s not a DRY violation. C(int); means that you didn&#=
39;t intend to<br>
&gt; &gt;&gt; write f(int);, so it is not really redundant.<br>
&gt; &gt;&gt;<br>
&gt; &gt;<br>
&gt; &gt; Why can&#39;t (int); also mean that you didn&#39;t intend to writ=
e f(int); ?<br>
&gt; &gt;<br>
&gt; <br>
&gt; It could but there is also the issue of harder spotting it/searching f=
or<br>
&gt; constructors for those of us that use text editors/diff tools instead =
of<br>
&gt; full blown IDEs.<br>
<br>
One advantage(?) of this proposal is that it allows constructors for anonym=
ous<br>
classes.<br>
<br>
class {<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 () : member() { /* something */ }<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ~() { /* something* / }<br>
private:<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 Foo member;<br>
} variable;</blockquote></div></div><div dir=3D"auto"><br></div><div dir=3D=
"auto">I personaly don&#39;t see that as such an advantage that would be a =
compelling reason to change the core language.</div><div dir=3D"auto">Lambd=
a functions are already a terse syntax for when you don&#39;t require a des=
tructor.</div><div dir=3D"auto">And in combination with p0052 scope guards =
you also get the destructor part - and such a templated class can allready =
be writen now in ~10 lines of code, put inside a util header and then used =
everywhere you like.</div><div dir=3D"auto"></div><div dir=3D"auto"><br></d=
iv><div dir=3D"auto">Regards,</div><div dir=3D"auto">Domen</div><div dir=3D=
"auto"><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=
=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</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" target=3D"_=
blank" rel=3D"noreferrer">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank" rel=3D"noreferrer">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/CAKgx6BKhpoXXgn6Np1UDb-w_Z8V%2B%2B8Dn=
7LE-Q4Gofte8pa4Jwg%40mail.gmail.com?utm_medium=3Demail&amp;utm_source=3Dfoo=
ter" target=3D"_blank" rel=3D"noreferrer">https://groups.google.com/a/isocp=
p.org/d/msgid/std-proposals/CAKgx6BKhpoXXgn6Np1UDb-w_Z8V%2B%2B8Dn7LE-Q4Goft=
e8pa4Jwg%40mail.gmail.com</a>.<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/CAC%2B0CCOE9TTx8eUd4GsPyqsKzOEPq-noGa=
B3ZV__2ytjjn5%3D%2Bw%40mail.gmail.com?utm_medium=3Demail&utm_source=3Dfoote=
r">https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAC%2B0CCOE=
9TTx8eUd4GsPyqsKzOEPq-noGaB3ZV__2ytjjn5%3D%2Bw%40mail.gmail.com</a>.<br />

--000000000000a7a31a05868ce435--

.


Author: kyleknoepfel@gmail.com
Date: Mon, 15 Apr 2019 06:34:26 -0700 (PDT)
Raw View
------=_Part_1791_1468916899.1555335266250
Content-Type: multipart/alternative;
 boundary="----=_Part_1792_760349562.1555335266250"

------=_Part_1792_760349562.1555335266250
Content-Type: text/plain; charset="UTF-8"

Yes, there are many different ways languages handle this (I actually like
D's "this(int)" construct).  I agree with Andrew and Jake that something
would be desirable that makes the specification of special functions
simpler, but "removing" the typename is prone to confusion.  I also suspect
that with metaclasses coming down the road, this problem will become less
of an issue to deal with.


On Monday, April 15, 2019 at 2:49:36 AM UTC-5, Jake Arkinstall wrote:
>
> I'm okay with the idea of a generic constructor (though I'm far from
> strongly opinioned either way) . I don't like the idea of leaving it blank
> though. Python's __init__ and PHP's __construct are clear, and that's an
> approach I'd rather. Internally, of course, it would just be relabelled
> with the class name.
>
>
> On Mon, 15 Apr 2019, 07:14 Domen Vrankar, <domen....@gmail.com
> <javascript:>> wrote:
>
>> On Sun, Apr 14, 2019, 20:58 Magnus Fromreide <ma...@lysator.liu.se
>> <javascript:>> wrote:
>>
>>> On Fri, Apr 12, 2019 at 02:08:58PM +0200, Domen Vrankar wrote:
>>> > On Fri, Apr 12, 2019, 12:56 Andrew Tomazos <andrew...@gmail.com
>>> <javascript:>> wrote:
>>> >
>>> > > On Fri, Apr 12, 2019 at 8:55 PM Bo Persson <b...@bo-persson.se
>>> <javascript:>> wrote:
>>> > >
>>> > >> On 2019-04-12 at 12:29, Andrew Tomazos wrote:
>>> > >> > Each constructor declaration within a class definition of C
>>> requires
>>> > >> the
>>> > >> > repetition of the (injected) class name C.  I suspect this is
>>> > >> > redundant.  Couldn't we allow the C to be taken as implied, and
>>> permit
>>> > >> > it to be omitted?  Likewise for destructor?
>>> > >> >
>>> > >> > // TODAY
>>> > >> > class C {
>>> > >> >      C();
>>> > >> >      C(int);
>>> > >> >      ~C();
>>> > >> > };
>>> > >> >
>>> > >> > // PROPOSED
>>> > >> > class C {
>>> > >> >      ();
>>> > >> >      (int);
>>> > >> >      ~();
>>> > >> > };
>>> > >> >
>>> > >> > The motivation is simply to get rid of some DRY violations.
>>> > >> >
>>> > >>
>>> > >> That's not a DRY violation. C(int); means that you didn't intend to
>>> > >> write f(int);, so it is not really redundant.
>>> > >>
>>> > >
>>> > > Why can't (int); also mean that you didn't intend to write f(int); ?
>>> > >
>>> >
>>> > It could but there is also the issue of harder spotting it/searching
>>> for
>>> > constructors for those of us that use text editors/diff tools instead
>>> of
>>> > full blown IDEs.
>>>
>>> One advantage(?) of this proposal is that it allows constructors for
>>> anonymous
>>> classes.
>>>
>>> class {
>>>         () : member() { /* something */ }
>>>         ~() { /* something* / }
>>> private:
>>>         Foo member;
>>> } variable;
>>
>>
>> I personaly don't see that as such an advantage that would be a
>> compelling reason to change the core language.
>> Lambda functions are already a terse syntax for when you don't require a
>> destructor.
>> And in combination with p0052 scope guards you also get the destructor
>> part - and such a templated class can allready be writen now in ~10 lines
>> of code, put inside a util header and then used everywhere you like.
>>
>> Regards,
>> Domen
>>
>>> --
>> 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-pr...@isocpp.org <javascript:>.
>> To post to this group, send email to std-pr...@isocpp.org <javascript:>.
>> To view this discussion on the web visit
>> https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAKgx6BKhpoXXgn6Np1UDb-w_Z8V%2B%2B8Dn7LE-Q4Gofte8pa4Jwg%40mail.gmail.com
>> <https://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAKgx6BKhpoXXgn6Np1UDb-w_Z8V%2B%2B8Dn7LE-Q4Gofte8pa4Jwg%40mail.gmail.com?utm_medium=email&utm_source=footer>
>> .
>>
>

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

------=_Part_1792_760349562.1555335266250
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Yes, there are many different ways languages handle this (=
I actually like D&#39;s &quot;this(int)&quot; construct). =C2=A0I agree wit=
h Andrew and Jake that something would be desirable that makes the specific=
ation of special functions simpler, but &quot;removing&quot; the typename i=
s prone to confusion. =C2=A0I also suspect that with metaclasses coming dow=
n the road, this problem will become less of an issue to deal with.<div><br=
></div><div><br>On Monday, April 15, 2019 at 2:49:36 AM UTC-5, Jake Arkinst=
all 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"auto">I&=
#39;m okay with the idea of a generic constructor (though I&#39;m far from =
strongly opinioned either way) . I don&#39;t like the idea of leaving it bl=
ank though. Python&#39;s __init__ and PHP&#39;s __construct are clear, and =
that&#39;s an approach I&#39;d rather. Internally, of course, it would just=
 be relabelled with the class name.<div dir=3D"auto"><br></div></div><br><d=
iv class=3D"gmail_quote"><div dir=3D"ltr">On Mon, 15 Apr 2019, 07:14 Domen =
Vrankar, &lt;<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailt=
o=3D"Din4aH1FCAAJ" rel=3D"nofollow" onmousedown=3D"this.href=3D&#39;javascr=
ipt:&#39;;return true;" onclick=3D"this.href=3D&#39;javascript:&#39;;return=
 true;">domen....@gmail.com</a>&gt; wrote:<br></div><blockquote class=3D"gm=
ail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-le=
ft:1ex"><div dir=3D"auto"><div><div class=3D"gmail_quote"><div dir=3D"ltr">=
On Sun, Apr 14, 2019, 20:58 Magnus Fromreide &lt;<a href=3D"javascript:" re=
l=3D"nofollow" target=3D"_blank" gdf-obfuscated-mailto=3D"Din4aH1FCAAJ" onm=
ousedown=3D"this.href=3D&#39;javascript:&#39;;return true;" onclick=3D"this=
..href=3D&#39;javascript:&#39;;return true;">ma...@lysator.liu.se</a>&gt; wr=
ote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;=
border-left:1px #ccc solid;padding-left:1ex">On Fri, Apr 12, 2019 at 02:08:=
58PM +0200, Domen Vrankar wrote:<br>
&gt; On Fri, Apr 12, 2019, 12:56 Andrew Tomazos &lt;<a href=3D"javascript:"=
 rel=3D"nofollow" target=3D"_blank" gdf-obfuscated-mailto=3D"Din4aH1FCAAJ" =
onmousedown=3D"this.href=3D&#39;javascript:&#39;;return true;" onclick=3D"t=
his.href=3D&#39;javascript:&#39;;return true;">andrew...@gmail.com</a>&gt; =
wrote:<br>
&gt; <br>
&gt; &gt; On Fri, Apr 12, 2019 at 8:55 PM Bo Persson &lt;<a href=3D"javascr=
ipt:" rel=3D"nofollow" target=3D"_blank" gdf-obfuscated-mailto=3D"Din4aH1FC=
AAJ" onmousedown=3D"this.href=3D&#39;javascript:&#39;;return true;" onclick=
=3D"this.href=3D&#39;javascript:&#39;;return true;">b...@bo-persson.se</a>&=
gt; wrote:<br>
&gt; &gt;<br>
&gt; &gt;&gt; On 2019-04-12 at 12:29, Andrew Tomazos wrote:<br>
&gt; &gt;&gt; &gt; Each constructor declaration within a class definition o=
f C requires<br>
&gt; &gt;&gt; the<br>
&gt; &gt;&gt; &gt; repetition of the (injected) class name C.=C2=A0 I suspe=
ct this is<br>
&gt; &gt;&gt; &gt; redundant.=C2=A0 Couldn&#39;t we allow the C to be taken=
 as implied, and permit<br>
&gt; &gt;&gt; &gt; it to be omitted?=C2=A0 Likewise for destructor?<br>
&gt; &gt;&gt; &gt;<br>
&gt; &gt;&gt; &gt; // TODAY<br>
&gt; &gt;&gt; &gt; class C {<br>
&gt; &gt;&gt; &gt;=C2=A0 =C2=A0 =C2=A0 C();<br>
&gt; &gt;&gt; &gt;=C2=A0 =C2=A0 =C2=A0 C(int);<br>
&gt; &gt;&gt; &gt;=C2=A0 =C2=A0 =C2=A0 ~C();<br>
&gt; &gt;&gt; &gt; };<br>
&gt; &gt;&gt; &gt;<br>
&gt; &gt;&gt; &gt; // PROPOSED<br>
&gt; &gt;&gt; &gt; class C {<br>
&gt; &gt;&gt; &gt;=C2=A0 =C2=A0 =C2=A0 ();<br>
&gt; &gt;&gt; &gt;=C2=A0 =C2=A0 =C2=A0 (int);<br>
&gt; &gt;&gt; &gt;=C2=A0 =C2=A0 =C2=A0 ~();<br>
&gt; &gt;&gt; &gt; };<br>
&gt; &gt;&gt; &gt;<br>
&gt; &gt;&gt; &gt; The motivation is simply to get rid of some DRY violatio=
ns.<br>
&gt; &gt;&gt; &gt;<br>
&gt; &gt;&gt;<br>
&gt; &gt;&gt; That&#39;s not a DRY violation. C(int); means that you didn&#=
39;t intend to<br>
&gt; &gt;&gt; write f(int);, so it is not really redundant.<br>
&gt; &gt;&gt;<br>
&gt; &gt;<br>
&gt; &gt; Why can&#39;t (int); also mean that you didn&#39;t intend to writ=
e f(int); ?<br>
&gt; &gt;<br>
&gt; <br>
&gt; It could but there is also the issue of harder spotting it/searching f=
or<br>
&gt; constructors for those of us that use text editors/diff tools instead =
of<br>
&gt; full blown IDEs.<br>
<br>
One advantage(?) of this proposal is that it allows constructors for anonym=
ous<br>
classes.<br>
<br>
class {<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 () : member() { /* something */ }<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 ~() { /* something* / }<br>
private:<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 Foo member;<br>
} variable;</blockquote></div></div><div dir=3D"auto"><br></div><div dir=3D=
"auto">I personaly don&#39;t see that as such an advantage that would be a =
compelling reason to change the core language.</div><div dir=3D"auto">Lambd=
a functions are already a terse syntax for when you don&#39;t require a des=
tructor.</div><div dir=3D"auto">And in combination with p0052 scope guards =
you also get the destructor part - and such a templated class can allready =
be writen now in ~10 lines of code, put inside a util header and then used =
everywhere you like.</div><div dir=3D"auto"></div><div dir=3D"auto"><br></d=
iv><div dir=3D"auto">Regards,</div><div dir=3D"auto">Domen</div><div dir=3D=
"auto"><div class=3D"gmail_quote"><blockquote class=3D"gmail_quote" style=
=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</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"javascript:" rel=3D"nofollow" target=3D"_blank" gdf-obfu=
scated-mailto=3D"Din4aH1FCAAJ" onmousedown=3D"this.href=3D&#39;javascript:&=
#39;;return true;" onclick=3D"this.href=3D&#39;javascript:&#39;;return true=
;">std-pr...@<wbr>isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"javascript:" rel=3D"nofollo=
w" target=3D"_blank" gdf-obfuscated-mailto=3D"Din4aH1FCAAJ" onmousedown=3D"=
this.href=3D&#39;javascript:&#39;;return true;" onclick=3D"this.href=3D&#39=
;javascript:&#39;;return true;">std-pr...@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/CAKgx6BKhpoXXgn6Np1UDb-w_Z8V%2B%2B8Dn=
7LE-Q4Gofte8pa4Jwg%40mail.gmail.com?utm_medium=3Demail&amp;utm_source=3Dfoo=
ter" rel=3D"nofollow" target=3D"_blank" onmousedown=3D"this.href=3D&#39;htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAKgx6BKhpoXXgn6N=
p1UDb-w_Z8V%2B%2B8Dn7LE-Q4Gofte8pa4Jwg%40mail.gmail.com?utm_medium\x3demail=
\x26utm_source\x3dfooter&#39;;return true;" onclick=3D"this.href=3D&#39;htt=
ps://groups.google.com/a/isocpp.org/d/msgid/std-proposals/CAKgx6BKhpoXXgn6N=
p1UDb-w_Z8V%2B%2B8Dn7LE-Q4Gofte8pa4Jwg%40mail.gmail.com?utm_medium\x3demail=
\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/a/<wb=
r>isocpp.org/d/msgid/std-<wbr>proposals/<wbr>CAKgx6BKhpoXXgn6Np1UDb-w_Z8V%<=
wbr>2B%2B8Dn7LE-Q4Gofte8pa4Jwg%<wbr>40mail.gmail.com</a>.<br>
</blockquote></div>
</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/c66ed8b6-9e4b-4f6c-abd1-ae08732c9579%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/c66ed8b6-9e4b-4f6c-abd1-ae08732c9579=
%40isocpp.org</a>.<br />

------=_Part_1792_760349562.1555335266250--

------=_Part_1791_1468916899.1555335266250--

.