Topic: Class implementation blocks
Author: fbcpp@gmx.de
Date: Wed, 11 Jul 2018 03:49:54 -0700 (PDT)
Raw View
------=_Part_127560_699182067.1531306194441
Content-Type: multipart/alternative;
boundary="----=_Part_127561_225798149.1531306194442"
------=_Part_127561_225798149.1531306194442
Content-Type: text/plain; charset="UTF-8"
Hello,
in many companies it is common practice to separate the class definition
from its implementation. Some coding guidelines recommend this separation
even for inline methods and template classes. Especially for template class
definitions this separation requires a lot of repeated template, typename
and class scope specifiers. These repeated specifiers:
- draw attention from the implementation itself,
- make code formatting harder and
- lead to unnecessary compiler runs caused by mistyped specifiers or
missing typename statements.
I would like to propose some kind of class implementation blocks. The
purpose of these class implementation blocks is to group the method
implementations within a block to avoid the need to specifiy the class
scope for each method implementation. Especially for template classes this
can save a lot of repeated class scope definitions and typename specifiers.
For non-templated non-member functions of template classes, such class
implementation blocks would allow an implementation without cluttering the
class definition with implementation details.
The proposed syntax is similar to the class definition but to use double
braces ('{{' and '}}') to mark the begin and end of the class
implementation blocks (using double braces is just a first idea, better
proposals are welcome!).
Within the implementation blocks the methods can be implemented as if they
were implemented within the class definition. Despite the implementation in
the class definition, they are not defined as inline function by default.
To define methods inline the inline keyword has to be used in the class
definition.
template < class MyTemplateParameter >
class MyExample
{
public:
MyExample();
void MyNonInlineMethod();
inline MyTemplateParameter MyInlineMethod();
friend void MyNonTemplatedNonMemberFunction();
private:
static MyTemplateParameter StaticValue;
};
template < class MyTemplateParameter >
class MyExample
{{
MyTemplateParameter StaticValue;
MyExample()
{ }
void MyNonInlineMethod()
{
/* ... */
}
MyTemplateParameter MyInlineMethod()
{
/* ... */
}
friend void MyNonTemplatedNonMemberFunction()
{
/* ... */
}
}};
Several class definition blocks can be defined for one class. This might be
useful for inline method definitions within the header file and the
non-inline methods within the cpp-file.
Once such class implementation blocks are introduced further extensions
might be discussed. E. g. the definition of local, non-virtual private
methods could be allowed within class implementation blocks. Local means,
that these methods should only be known within the class implementation
block they are defined in.
In my eyes such class implementation blocks would help to minimize the
class definitions to a pure interface description of the class. Especially
the extension mentioned above would allow to move all implementation
details such as (non-virtual) private methods and method implementations
into these new class definition blocks.
What do you think about such a feature?
Frank
--
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/acab179e-f15b-4ebd-9ce1-fb6df833b3b6%40isocpp.org.
------=_Part_127561_225798149.1531306194442
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Hello,<br><br>in many companies it is common practice to s=
eparate the class definition from its implementation.=C2=A0 Some coding gui=
delines recommend this separation even for inline methods and template clas=
ses. Especially for template class definitions this separation requires a l=
ot of repeated template, typename and class scope specifiers. These repeate=
d specifiers:<br><ul><li>draw attention from the implementation itself,</li=
><li>make code formatting harder and</li><li>lead to unnecessary compiler r=
uns caused by mistyped specifiers or missing typename statements.<br></li><=
/ul>I would like to propose some kind of class implementation blocks.=C2=A0=
The purpose of these class implementation blocks is to group the method im=
plementations within a block to avoid the need to specifiy the class scope =
for each method implementation.=C2=A0 Especially for template classes this =
can save a lot of repeated class scope definitions and typename specifiers.=
For non-templated non-member functions of template classes, such class imp=
lementation blocks would allow an implementation without cluttering the cla=
ss definition with implementation details.<br><br>The proposed syntax is si=
milar to the class definition but to use double braces ('{{' and &#=
39;}}') to mark the begin and end of the class implementation blocks (u=
sing double braces is just a first idea, better proposals are welcome!).<br=
><br>Within the implementation blocks the methods can be implemented as if =
they were implemented within the class definition. Despite the implementati=
on in the class definition, they are not defined as inline function by defa=
ult. To define methods inline the inline keyword has to be used in the clas=
s definition.<br><br><span style=3D"font-family: courier new, monospace;"><=
div style=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 1=
87, 187); border-style: solid; border-width: 1px; overflow-wrap: break-word=
;" class=3D"prettyprint"><code class=3D"prettyprint"><div class=3D"subprett=
yprint"><span style=3D"color: #008;" class=3D"styled-by-prettify">template<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify"><</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"col=
or: #008;" class=3D"styled-by-prettify">class</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" cla=
ss=3D"styled-by-prettify">MyTemplateParameter</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">></span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"styled=
-by-prettify">class</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">=
MyExample</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></span><span=
style=3D"color: #008;" class=3D"styled-by-prettify">public</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>=C2=A0 =C2=A0 </span><span styl=
e=3D"color: #606;" class=3D"styled-by-prettify">MyExample</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">();</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"><br><br>=C2=A0 =C2=A0 </span><span =
style=3D"color: #008;" class=3D"styled-by-prettify">void</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #606;" class=3D"styled-by-prettify">MyNonInlineMethod</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">();</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"><br><br>=C2=A0 =C2=A0 </span><span =
style=3D"color: #008;" class=3D"styled-by-prettify">inline</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #606;" class=3D"styled-by-prettify">MyTemplateParameter</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #606;" class=3D"styled-by-prettify">MyInlineMethod</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 styl=
e=3D"color: #008;" class=3D"styled-by-prettify">friend</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #=
008;" class=3D"styled-by-prettify">void</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=3D"=
styled-by-prettify">MyNonTemplatedNonMemberFunction</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">();</span><span style=3D"color: #0=
00;" 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>=C2=A0 =C2=A0 </span><span style=3D"color: #008;" c=
lass=3D"styled-by-prettify">static</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=3D"style=
d-by-prettify">MyTemplateParameter</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> =C2=A0</span><span style=3D"color: #606;" class=3D=
"styled-by-prettify">StaticValue</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><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><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">t=
emplate</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"> </span><span styl=
e=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: #6=
06;" class=3D"styled-by-prettify">MyTemplateParameter</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">></span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">class</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-=
prettify">MyExample</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"><br></span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">{{</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-pretti=
fy"><span style=3D"font-family: courier new, monospace;"><code class=3D"pre=
ttyprint"><span style=3D"color: #606;" class=3D"styled-by-prettify">MyTempl=
ateParameter</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
">=C2=A0 </span><span style=3D"color: #606;" class=3D"styled-by-prettify"><=
/span></code></span>StaticValue</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"><br><br>=C2=A0 =C2=A0 </span><span style=3D"color: #606;" class=
=3D"styled-by-prettify">MyExample</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">()</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"><br>=C2=A0 =C2=A0 </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">}</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-p=
rettify">void</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">MyNonI=
nlineMethod</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: #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: #800;" class=3D"style=
d-by-prettify">/* ... */</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"><br>=C2=A0 =C2=A0 </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>=C2=A0 =C2=A0 </span><span style=3D"color: #606;" cl=
ass=3D"styled-by-prettify">MyTemplateParameter</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" cl=
ass=3D"styled-by-prettify">MyInlineMethod</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: #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: #800;" 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>=C2=A0 =C2=A0 </span=
><span style=3D"color: #008;" class=3D"styled-by-prettify">friend</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">void</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #606=
;" class=3D"styled-by-prettify">MyNonTemplatedNonMemberFunction</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><sp=
an 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: #800;" 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: #660;" class=3D"styled-by-prettify"=
>}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">}};</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br></span></div></co=
de></div></span><br>Several class definition blocks can be defined for one =
class. This might be useful for inline method definitions within the header=
file and the non-inline methods within the cpp-file.<br><br>Once such clas=
s implementation blocks are introduced further extensions might be discusse=
d.=C2=A0 E. g. the definition of local, non-virtual private methods could b=
e allowed within class implementation blocks.=C2=A0 Local means, that these=
methods should only be known within the class implementation block they ar=
e defined in.<br><br>In my eyes such class implementation blocks would help=
to minimize the class definitions to a pure interface description of the c=
lass. Especially the extension mentioned above would allow to move all impl=
ementation details such as (non-virtual) private methods and method impleme=
ntations into these new class definition blocks.<br><br>What do you think a=
bout such a feature?<br><br>Frank<br><br></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/acab179e-f15b-4ebd-9ce1-fb6df833b3b6%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/acab179e-f15b-4ebd-9ce1-fb6df833b3b6=
%40isocpp.org</a>.<br />
------=_Part_127561_225798149.1531306194442--
------=_Part_127560_699182067.1531306194441--
.
Author: mihailnajdenov@gmail.com
Date: Wed, 11 Jul 2018 06:55:43 -0700 (PDT)
Raw View
------=_Part_127813_833752550.1531317343456
Content-Type: multipart/alternative;
boundary="----=_Part_127814_1091034929.1531317343456"
------=_Part_127814_1091034929.1531317343456
Content-Type: text/plain; charset="UTF-8"
On Wednesday, July 11, 2018 at 1:49:54 PM UTC+3, fb...@gmx.de wrote:
>
> Hello,
>
> in many companies it is common practice to separate the class definition
> from its implementation. Some coding guidelines recommend this separation
> even for inline methods and template classes. Especially for template class
> definitions this separation requires a lot of repeated template, typename
> and class scope specifiers. These repeated specifiers:
>
> - draw attention from the implementation itself,
> - make code formatting harder and
> - lead to unnecessary compiler runs caused by mistyped specifiers or
> missing typename statements.
>
> I would like to propose some kind of class implementation blocks. The
> purpose of these class implementation blocks is to group the method
> implementations within a block to avoid the need to specifiy the class
> scope for each method implementation. Especially for template classes this
> can save a lot of repeated class scope definitions and typename specifiers.
> For non-templated non-member functions of template classes, such class
> implementation blocks would allow an implementation without cluttering the
> class definition with implementation details.
>
> The proposed syntax is similar to the class definition but to use double
> braces ('{{' and '}}') to mark the begin and end of the class
> implementation blocks (using double braces is just a first idea, better
> proposals are welcome!).
>
> Within the implementation blocks the methods can be implemented as if they
> were implemented within the class definition. Despite the implementation in
> the class definition, they are not defined as inline function by default.
> To define methods inline the inline keyword has to be used in the class
> definition.
>
> template < class MyTemplateParameter >
> class MyExample
> {
> public:
> MyExample();
>
> void MyNonInlineMethod();
>
> inline MyTemplateParameter MyInlineMethod();
>
> friend void MyNonTemplatedNonMemberFunction();
>
> private:
> static MyTemplateParameter StaticValue;
> };
>
> template < class MyTemplateParameter >
> class MyExample
> {{
> MyTemplateParameter StaticValue;
>
> MyExample()
> { }
>
> void MyNonInlineMethod()
> {
> /* ... */
> }
>
> MyTemplateParameter MyInlineMethod()
> {
> /* ... */
> }
>
> friend void MyNonTemplatedNonMemberFunction()
> {
> /* ... */
> }
> }};
>
> Several class definition blocks can be defined for one class. This might
> be useful for inline method definitions within the header file and the
> non-inline methods within the cpp-file.
>
> Once such class implementation blocks are introduced further extensions
> might be discussed. E. g. the definition of local, non-virtual private
> methods could be allowed within class implementation blocks. Local means,
> that these methods should only be known within the class implementation
> block they are defined in.
>
> In my eyes such class implementation blocks would help to minimize the
> class definitions to a pure interface description of the class. Especially
> the extension mentioned above would allow to move all implementation
> details such as (non-virtual) private methods and method implementations
> into these new class definition blocks.
>
> What do you think about such a feature?
>
> Frank
>
http://open-std.org/JTC1/SC22/WG21/docs/papers/2016/p0223r0.html
Beats me, what happened.
I personally don't like the term class namespace as it is misleading -
indeed namespaces should be reopenable, variables should be declarable,
does it affect/impose linkage of these variables and so on.
Best syntax option IMO is
template <class MyTemplateParameter>
MyExample<MyTemplateParameter>::
{
MyExample()
{}
};
This way we both do not reintroduce the class (by stating class in front of
its name) and we literally repeat the syntax we already use but on bigger
scope.
--
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/c8156cc1-ea34-4bee-a88c-c8a32c663056%40isocpp.org.
------=_Part_127814_1091034929.1531317343456
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Wednesday, July 11, 2018 at 1:49:54 PM UTC+3, f=
b...@gmx.de wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;marg=
in-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"=
ltr">Hello,<br><br>in many companies it is common practice to separate the =
class definition from its implementation.=C2=A0 Some coding guidelines reco=
mmend this separation even for inline methods and template classes. Especia=
lly for template class definitions this separation requires a lot of repeat=
ed template, typename and class scope specifiers. These repeated specifiers=
:<br><ul><li>draw attention from the implementation itself,</li><li>make co=
de formatting harder and</li><li>lead to unnecessary compiler runs caused b=
y mistyped specifiers or missing typename statements.<br></li></ul>I would =
like to propose some kind of class implementation blocks.=C2=A0 The purpose=
of these class implementation blocks is to group the method implementation=
s within a block to avoid the need to specifiy the class scope for each met=
hod implementation.=C2=A0 Especially for template classes this can save a l=
ot of repeated class scope definitions and typename specifiers. For non-tem=
plated non-member functions of template classes, such class implementation =
blocks would allow an implementation without cluttering the class definitio=
n with implementation details.<br><br>The proposed syntax is similar to the=
class definition but to use double braces ('{{' and '}}') =
to mark the begin and end of the class implementation blocks (using double =
braces is just a first idea, better proposals are welcome!).<br><br>Within =
the implementation blocks the methods can be implemented as if they were im=
plemented within the class definition. Despite the implementation in the cl=
ass definition, they are not defined as inline function by default. To defi=
ne methods inline the inline keyword has to be used in the class definition=
..<br><br><span style=3D"font-family:courier new,monospace"><div style=3D"ba=
ckground-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:=
solid;border-width:1px"><code><div><span style=3D"color:#008">template</spa=
n><span style=3D"color:#000"> </span><span style=3D"color:#660"><</span>=
<span style=3D"color:#000"> </span><span style=3D"color:#008">class</span><=
span style=3D"color:#000"> </span><span style=3D"color:#606">MyTemplatePara=
meter</span><span style=3D"color:#000"> </span><span style=3D"color:#660">&=
gt;</span><span style=3D"color:#000"><br></span><span style=3D"color:#008">=
class</span><span style=3D"color:#000"> </span><span style=3D"color:#606">M=
yExample</span><span style=3D"color:#000"><br></span><span style=3D"color:#=
660">{</span><span style=3D"color:#000"><br></span><span style=3D"color:#00=
8">public</span><span style=3D"color:#660">:</span><span style=3D"color:#00=
0"><br>=C2=A0 =C2=A0 </span><span style=3D"color:#606">MyExample</span><spa=
n style=3D"color:#660">();</span><span style=3D"color:#000"><br><br>=C2=A0 =
=C2=A0 </span><span style=3D"color:#008">void</span><span style=3D"color:#0=
00"> </span><span style=3D"color:#606">MyNonInlineMethod</span><span style=
=3D"color:#660">();</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 =
</span><span style=3D"color:#008">inline</span><span style=3D"color:#000"> =
</span><span style=3D"color:#606">MyTemplateParameter</span><span style=3D"=
color:#000"> </span><span style=3D"color:#606">MyInlineMethod</span><span s=
tyle=3D"color:#660">();</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=
=A0 </span><span style=3D"color:#008">friend</span><span style=3D"color:#00=
0"> </span><span style=3D"color:#008">void</span><span style=3D"color:#000"=
> </span><span style=3D"color:#606">MyNonTemplatedNonMemberFunctio<wbr>n</s=
pan><span style=3D"color:#660">();</span><span style=3D"color:#000"><br><br=
></span><span style=3D"color:#008">private</span><span style=3D"color:#660"=
>:</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D=
"color:#008">static</span><span style=3D"color:#000"> </span><span style=3D=
"color:#606">MyTemplateParameter</span><span style=3D"color:#000"> =C2=A0</=
span><span style=3D"color:#606">StaticValue</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><br></span><span style=3D"color:#00=
8">template</span><span style=3D"color:#000"> </span><span style=3D"color:#=
660"><</span><span style=3D"color:#000"> </span><span style=3D"color:#00=
8">class</span><span style=3D"color:#000"> </span><span style=3D"color:#606=
">MyTemplateParameter</span><span style=3D"color:#000"> </span><span style=
=3D"color:#660">></span><span style=3D"color:#000"><br></span><span styl=
e=3D"color:#008">class</span><span style=3D"color:#000"> </span><span style=
=3D"color:#606">MyExample</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:#606"><span style=3D"font-family:courier new,m=
onospace"><code><span style=3D"color:#606">MyTemplateParameter</span><span =
style=3D"color:#000">=C2=A0 </span><span style=3D"color:#606"></span></code=
></span>StaticValue</span><span style=3D"color:#660">;</span><span style=3D=
"color:#000"><br><br>=C2=A0 =C2=A0 </span><span style=3D"color:#606">MyExam=
ple</span><span style=3D"color:#660">()</span><span style=3D"color:#000"><b=
r>=C2=A0 =C2=A0 </span><span style=3D"color:#660">{</span><span style=3D"co=
lor:#000"> </span><span style=3D"color:#660">}</span><span style=3D"color:#=
000"><br><br>=C2=A0 =C2=A0 </span><span style=3D"color:#008">void</span><sp=
an style=3D"color:#000"> </span><span style=3D"color:#606">MyNonInlineMetho=
d</span><span style=3D"color:#660">()</span><span style=3D"color:#000"><br>=
=C2=A0 =C2=A0 </span><span style=3D"color:#660">{</span><span style=3D"colo=
r:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#800">/=
* ... */</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span st=
yle=3D"color:#660">}</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=A0=
</span><span style=3D"color:#606">MyTemplateParameter</span><span style=3D=
"color:#000"> </span><span style=3D"color:#606">MyInlineMethod</span><span =
style=3D"color:#660">()</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =
</span><span style=3D"color:#660">{</span><span style=3D"color:#000"><br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#800">/* ... */</sp=
an><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </span><span style=3D"color=
:#660">}</span><span style=3D"color:#000"><br><br>=C2=A0 =C2=A0 </span><spa=
n style=3D"color:#008">friend</span><span style=3D"color:#000"> </span><spa=
n style=3D"color:#008">void</span><span style=3D"color:#000"> </span><span =
style=3D"color:#606">MyNonTemplatedNonMemberFunctio<wbr>n</span><span style=
=3D"color:#660">()</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 </spa=
n><span style=3D"color:#660">{</span><span style=3D"color:#000"><br>=C2=A0 =
=C2=A0 =C2=A0 =C2=A0 </span><span style=3D"color:#800">/* ... */</span><spa=
n style=3D"color:#000"><br>=C2=A0 =C2=A0 </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></div></code></div></span><br=
>Several class definition blocks can be defined for one class. This might b=
e useful for inline method definitions within the header file and the non-i=
nline methods within the cpp-file.<br><br>Once such class implementation bl=
ocks are introduced further extensions might be discussed.=C2=A0 E. g. the =
definition of local, non-virtual private methods could be allowed within cl=
ass implementation blocks.=C2=A0 Local means, that these methods should onl=
y be known within the class implementation block they are defined in.<br><b=
r>In my eyes such class implementation blocks would help to minimize the cl=
ass definitions to a pure interface description of the class. Especially th=
e extension mentioned above would allow to move all implementation details =
such as (non-virtual) private methods and method implementations into these=
new class definition blocks.<br><br>What do you think about such a feature=
?<br><br>Frank<br></div></blockquote><div><br></div><div><br></div><div>htt=
p://open-std.org/JTC1/SC22/WG21/docs/papers/2016/p0223r0.html</div><div><br=
></div><div>Beats me, what happened.<br></div><div>I personally don't l=
ike the term class namespace as it is misleading - indeed namespaces should=
be reopenable, variables should be declarable, does it affect/impose linka=
ge of these variables and so on.</div><div><br></div><div>Best syntax optio=
n IMO is</div><div><br></div><font face=3D"courier new,monospace">template =
<class MyTemplateParameter><br>MyExample<<span style=3D"display: i=
nline !important; float: none; background-color: transparent; color: rgb(34=
, 34, 34); font-family: courier new,monospace; font-size: 13px; font-style:=
normal; font-variant: normal; font-weight: 400; letter-spacing: normal; or=
phans: 2; text-align: left; text-decoration: none; text-indent: 0px; text-t=
ransform: none; -webkit-text-stroke-width: 0px; white-space: normal; word-s=
pacing: 0px;">MyTemplateParameter</span>>::<br><div>{</div><div>=C2=A0 <=
span style=3D"display: inline !important; float: none; background-color: tr=
ansparent; color: rgb(34, 34, 34); font-family: courier new,monospace; font=
-size: 13px; font-style: normal; font-variant: normal; font-weight: 400; le=
tter-spacing: normal; orphans: 2; text-align: left; text-decoration: none; =
text-indent: 0px; text-transform: none; -webkit-text-stroke-width: 0px; whi=
te-space: normal; word-spacing: 0px;">MyExample()</span></div><div>=C2=A0 {=
}=C2=A0</div></font><div><font face=3D"courier new,monospace">};</font></di=
v><div><font face=3D"courier new,monospace"><br></font></div><div><font fac=
e=3D"arial,sans-serif">This way we both do not reintroduce the class (by st=
ating <font face=3D"courier new,monospace">class</font> in front of its nam=
e) and we literally repeat the syntax we already use but on bigger scope.</=
font></div><div><font face=3D"arial,sans-serif"><br></font></div></div>
<p></p>
-- <br />
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
To view this discussion on the web visit <a href=3D"https://groups.google.c=
om/a/isocpp.org/d/msgid/std-proposals/c8156cc1-ea34-4bee-a88c-c8a32c663056%=
40isocpp.org?utm_medium=3Demail&utm_source=3Dfooter">https://groups.google.=
com/a/isocpp.org/d/msgid/std-proposals/c8156cc1-ea34-4bee-a88c-c8a32c663056=
%40isocpp.org</a>.<br />
------=_Part_127814_1091034929.1531317343456--
------=_Part_127813_833752550.1531317343456--
.
Author: Matthew Woehlke <mwoehlke.floss@gmail.com>
Date: Fri, 27 Jul 2018 11:36:48 -0400
Raw View
On 2018-07-11 09:55, mihailnajdenov@gmail.com wrote:
> http://open-std.org/JTC1/SC22/WG21/docs/papers/2016/p0223r0.html
>
> Beats me, what happened.
I don't think it ever got presented. Also, reception was fairly lukewarm.
> I personally don't like the term class namespace as it is misleading -
Eh, the syntax/terminology is open to discussion.
> indeed namespaces should be reopenable, variables should be declarable,
> does it affect/impose linkage of these variables and so on.
No. It is *strictly* shorthand for prefixing every top level block in
the scope as if with the class name [and template parameters]. IOW, one
could write a simple code transform that would result in *exactly* the
same AST.
> Best syntax option IMO is
>
> template <class MyTemplateParameter>
> MyExample<MyTemplateParameter>::
> {
> MyExample()
> {}
> };
Yeah, that could work.
--
Matthew
--
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/8678d417-dc06-889f-e0a4-ffddd595b7f0%40gmail.com.
.