Topic: Nested namespaces by classes
Author: contact@ncomputers.org
Date: Mon, 20 Oct 2014 15:58:59 -0700 (PDT)
Raw View
------=_Part_818_1746238553.1413845939890
Content-Type: text/plain; charset=UTF-8
I recognize that I don't have neither the enough experience and the enough
knowledge to write a proposal with high probabilities to become standard
and to be considered seriously by the international ISO/ANSI C++ committee.
But I come here, I come to you as a customer. I am a customer of the
ISO/ANSI C++ programming language, because I use it. I write computer codes
using this language. I consume its words. I come here and share my
suggestions with the intention to improve the product, the amazing C++
programming language.
Because if the ISO/ANSI C++ committee's erudites (all of you), decide to
act as provider and hear me as a customer, you can gain some ideas to
improve the product, the C++ programming language. To improve it could ease
the life not only of the programmers while they write codes consuming its
words, but also of every living being of the earth, because technology is
today a very important support of our lifes.
For your comments, your time, your patience and your help, that at the end
become contributions, which I want to turn into solutions: I am infinite
thankful to all of you!
Nested namespaces by classes It is possible to nest a namespace inside
another namespace.
Classes, structs and unions are also namespaces, despite they have other
purpose.
Theoretically it should be possible to nest namespaces inside classes,
structs and unions, what could be very useful.
*For example:*
When several class members require the same variables, it could be useful
for the programmer to use *nested namespaces* to avoid the re-declaration
of the same variables.
It can also help compilers to optimize the code.
Personally I like to avoid the re-declaration of the same variables inside
different scopes, because sometimes they are too much.
I don't like either let them easily accessible.
When it is easy to access them, it is possible to use them accidentally,
what can cause problems, which sometimes require hours to find, because
they are hard to see.
Without *nested namespaces by classes*, I do prefer to re-declare the same
variables inside each scope to avoid confusions, despite it is an avoidable
tedious task.
On these cases, it would be easier to write: using namespace name; inside
the scope than to re-declare the same variables again.
It would also ease the identifying of scopes with shared variables.
Other reason to suggest this improvement is that it would allow to mix *nested
namespaces* with templates.
*Downloads: *nested namespaces classes.cpp
<http://ncomputers.org/download/code/suggestions/nested%20namespaces%20classes.cpp>
template<typename Typename>
struct Struct{
namespace shared{
Typename variable;
}
Struct():
shared::variable(0)
{}
void Function_1(){
//shared variable is visible
using namespace shared;
}
void Function_2(){
//use special variable
int variable;
}
void Function_3(){
{
//shared variable is visible
using namespace shared;
}
//use special variable
int variable;
}
};
Last modified: 2014 - Oct - 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 email to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_818_1746238553.1413845939890
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">I recognize that I don't have neither the enough experienc=
e and the enough knowledge to write a proposal with high probabilities to b=
ecome standard and to be considered seriously by the international ISO/ANSI=
C++ committee.<br><br>But I come here, I come to you as a customer. I am a=
customer of the ISO/ANSI C++ programming language, because I use it. I wri=
te computer codes using this language. I consume its words. I come here and=
share my suggestions with the intention to improve the product, the amazin=
g C++ programming language.<br><br>Because if the ISO/ANSI C++ committee's =
erudites (all of you), decide to act as provider and hear me as a customer,=
you can gain some ideas to improve the product, the C++ programming langua=
ge. To improve it could ease the life not only of the programmers while the=
y write codes consuming its words, but also of every living being of the ea=
rth, because technology is today a very important support of our lifes.<br>=
<br>For your comments, your time, your patience and your help, that at the =
end become contributions, which I want to turn into solutions: I am infinit=
e thankful to all of you!<br><br><h1>Nested namespaces by classes</h1>
It is possible to nest a namespace inside another namespace.<br><br>
Classes, structs and unions are also namespaces, despite they have other pu=
rpose.<br><br>
Theoretically it should be possible to nest namespaces inside classes, stru=
cts and unions, what could be very useful.<br><br>
<b>For example:</b><br><br>
When several class members require the same variables, it could be useful f=
or the programmer to use <b>nested namespaces</b> to avoid the re-declarati=
on of the same variables.<br><br>
It can also help compilers to optimize the code.<br><br>
Personally I like to avoid the re-declaration of the same variables=20
inside different scopes, because sometimes they are too much.<br><br>
I don't like either let them easily accessible.<br><br>
When it is easy to access them, it is possible to use them accidentally,
what can cause problems, which sometimes require hours to find, because
they are hard to see.<br><br>
Without <b>nested namespaces by classes</b>, I do prefer to re-declare the =
same variables inside each scope to avoid confusions, despite it is an avoi=
dable tedious task.<br><br>
On these cases, it would be easier to write: <code class=3D"code"><span cla=
ss=3D"keyword">using namespace</span> name;</code> inside the scope than to=
re-declare the same variables again.<br><br>
It would also ease the identifying of scopes with shared variables.<br><br>
Other reason to suggest this improvement is that it would allow to mix <b>n=
ested namespaces</b> with templates.<br><br>
<b>Downloads: </b><a href=3D"http://ncomputers.org/download/code/suggestion=
s/nested%20namespaces%20classes.cpp">nested namespaces classes.cpp</a><br><=
br>
<section class=3D"code"><code>
<div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); b=
order-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; wo=
rd-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subprettypr=
int"><span style=3D"color: #008;" class=3D"styled-by-prettify">template</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">typename</span><span=
style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D=
"color: #606;" class=3D"styled-by-prettify">Typename</span><span style=3D"c=
olor: #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">struct</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=3D"sty=
led-by-prettify">Struct</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"><br> </span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">namespace</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> shared</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"><br> </span><span style=3D"color: #60=
6;" class=3D"styled-by-prettify">Typename</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> variable</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;" cla=
ss=3D"styled-by-prettify"><br> <br> </span><span st=
yle=3D"color: #606;" class=3D"styled-by-prettify">Struct</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">():</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"><br> &nb=
sp;shared</span><span style=3D"color: #660;" class=3D"styled-by-prettify">:=
:</span><span style=3D"color: #000;" class=3D"styled-by-prettify">variable<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><sp=
an 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"><br> </span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">{}</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"><br> <br> &nb=
sp;</span><span style=3D"color: #008;" class=3D"styled-by-prettify">void</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span=
style=3D"color: #606;" class=3D"styled-by-prettify">Function_1</span><span=
style=3D"color: #660;" class=3D"styled-by-prettify">(){</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br> &nb=
sp; </span><span style=3D"color: #800;" class=3D"styled-by-prettify">=
//shared variable is visible</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br> </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">using</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #00=
8;" class=3D"styled-by-prettify">namespace</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> shared</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: #6=
60;" class=3D"styled-by-prettify">}</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"><br> <br> </span><span sty=
le=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: #6=
06;" class=3D"styled-by-prettify">Function_2</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">(){</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"><br> </span><sp=
an style=3D"color: #800;" class=3D"styled-by-prettify">//use special variab=
le</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbs=
p; </span><span style=3D"color: #008;" class=3D"=
styled-by-prettify">int</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> variable</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> </span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">}</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"><br> <br> </span><span style=3D"color: #008=
;" class=3D"styled-by-prettify">void</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=3D"sty=
led-by-prettify">Function_3</span><span style=3D"color: #660;" class=3D"sty=
led-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> =
</span><span style=3D"color: #800;" class=3D"styled-by-prettify">//sh=
ared variable is visible</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"><br> </span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">using</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"c=
olor: #008;" class=3D"styled-by-prettify">namespace</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> shared</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 styl=
e=3D"color: #000;" class=3D"styled-by-prettify"><br> &n=
bsp; </span><span style=3D"color: #800;" class=3D"styled-by-prettify"=
>//use special variable</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"><br> </span><span style=3D"co=
lor: #008;" class=3D"styled-by-prettify">int</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> variable</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br></span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=3D"s=
tyled-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"> </span></div></code></div><br></code></section>Last modified: 2014 - =
Oct - 20 <br></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_818_1746238553.1413845939890--
.
Author: contact@ncomputers.org
Date: Mon, 20 Oct 2014 16:05:45 -0700 (PDT)
Raw View
------=_Part_1_863438724.1413846345953
Content-Type: text/plain; charset=UTF-8
I recognize that I do not have neither the enough experience nor the enough
knowledge to write a proposal with high probabilities to become standard
and to be considered seriously by the international ISO/ANSI C++ committee.
But I come here, I come to you as a customer. I am a customer of the
ISO/ANSI C++ programming language, because I use it. I write computer codes
using this language. I consume its words. I come here and share my
suggestions with the intention to improve your product, the amazing C++
programming language.
Because if the ISO/ANSI C++ committee's erudites (all of you), decide to
hear me, you can gain some ideas to improve the amazing C++ programming
language. To improve it could ease the life not only of the programmers
while they write codes consuming its words, but also of every living being
of earth, because technology is today a very important support of our lifes.
For your comments, your time, your patience and your help, that at the end
become contributions, which I want to turn into solutions: I am infinite
thankful to all of you!
Nested namespaces by classes It is possible to nest a namespace inside
another namespace.
Classes, structs and unions are also namespaces, despite they have other
purpose.
Theoretically it should be possible to nest namespaces inside classes,
structs and unions, what could be very useful.
*For example:*
When several class members require the same variables, it could be useful
for the programmer to use *nested namespaces* to avoid the re-declaration
of the same variables.
It can also help compilers to optimize the code.
Personally I like to avoid the re-declaration of the same variables inside
different scopes, because sometimes they are too much.
I don't like either let them easily accessible.
When it is easy to access them, it is possible to use them accidentally,
what can cause problems, which sometimes require hours to find, because
they are hard to see.
Without *nested namespaces by classes*, I do prefer to re-declare the same
variables inside each scope to avoid confusions, despite it is an avoidable
tedious task.
On these cases, it would be easier to write: using namespace name; inside
the scope than to re-declare the same variables again.
It would also ease the identifying of scopes with shared variables.
Other reason to suggest this improvement is that it would allow to mix *nested
namespaces* with templates.
*Downloads: *nested namespaces classes.cpp
<http://ncomputers.org/download/code/suggestions/nested%20namespaces%20classes.cpp>
template<typename Typename>
struct Struct{
namespace shared{
Typename variable;
}
Struct():
shared::variable(0)
{}
void Function_1(){
//shared variable is visible
using namespace shared;
}
void Function_2(){
//use special variable
int variable;
}
void Function_3(){
{
//shared variable is visible
using namespace shared;
}
//use special variable
int variable;
}
};
http://ncomputers.org/content/code.php?src=suggestions/nested%20namespaces%20classes.cpp
--
---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_1_863438724.1413846345953
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">I recognize that I do not have neither the enough experien=
ce nor the enough knowledge to write a proposal with high probabilities to =
become standard and to be considered seriously by the international ISO/ANS=
I C++ committee.<br><br>But I come here, I come to you as a customer. I am =
a customer of the ISO/ANSI C++ programming language, because I use it. I wr=
ite computer codes using this language. I consume its words. I come here an=
d share my suggestions with the intention to improve your product, the amaz=
ing C++ programming language.<br><br>Because if the ISO/ANSI C++ committee'=
s erudites (all of you), decide to hear me, you can gain some ideas to impr=
ove the amazing C++ programming language. To improve it could ease the life=
not only of the programmers while they write codes consuming its words, bu=
t also of every living being of earth, because technology is today a very i=
mportant support of our lifes.<br><br>For your comments, your time, your pa=
tience and your help, that at the end become contributions, which I want to=
turn into solutions: I am infinite thankful to all of you!<br><br><h1>Nest=
ed namespaces by classes</h1>
It is possible to nest a namespace inside another namespace.<br><br>
Classes, structs and unions are also namespaces, despite they have other pu=
rpose.<br><br>
Theoretically it should be possible to nest namespaces inside classes, stru=
cts and unions, what could be very useful.<br><br>
<b>For example:</b><br><br>
When several class members require the same variables, it could be useful f=
or the programmer to use <b>nested namespaces</b> to avoid the re-declarati=
on of the same variables.<br><br>
It can also help compilers to optimize the code.<br><br>
Personally I like to avoid the re-declaration of the same variables=20
inside different scopes, because sometimes they are too much.<br><br>
I don't like either let them easily accessible.<br><br>
When it is easy to access them, it is possible to use them accidentally,
what can cause problems, which sometimes require hours to find, because
they are hard to see.<br><br>
Without <b>nested namespaces by classes</b>, I do prefer to re-declare the =
same variables inside each scope to avoid confusions, despite it is an avoi=
dable tedious task.<br><br>
On these cases, it would be easier to write: <code class=3D"code"><span cla=
ss=3D"keyword">using namespace</span> name;</code> inside the scope than to=
re-declare the same variables again.<br><br>
It would also ease the identifying of scopes with shared variables.<br><br>
Other reason to suggest this improvement is that it would allow to mix <b>n=
ested namespaces</b> with templates.<br><br>
<b>Downloads: </b><a href=3D"http://ncomputers.org/download/code/suggestion=
s/nested%20namespaces%20classes.cpp">nested namespaces classes.cpp</a><br><=
br>
<section class=3D"code"><code><div class=3D"prettyprint" style=3D"backgroun=
d-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style=
: solid; border-width: 1px; word-wrap: break-word;"><code class=3D"prettypr=
int"><div class=3D"subprettyprint"><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">template</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify"><</span><span style=3D"color: #008;" class=3D"styled-by-=
prettify">typename</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">T=
ypename</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">struct</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span=
style=3D"color: #606;" class=3D"styled-by-prettify">Struct</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><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">namespace</span><span=
style=3D"color: #000;" class=3D"styled-by-prettify"> shared</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br> &n=
bsp;</span><span style=3D"color: #606;" class=3D"styled-by-prettify">Typena=
me</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> variabl=
e</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">}</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"><br> <br=
> </span><span style=3D"color: #606;" class=3D"styled-by=
-prettify">Struct</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">():</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
<br> shared</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">::</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify">variable</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(</span><span style=3D"color: #066;" class=3D"style=
d-by-prettify">0</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">)</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-prettif=
y"><br> <br> </span><span style=3D"color: #008;" cl=
ass=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-b=
y-prettify">Function_1</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">(){</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"><br> </span><span style=3D"color: #80=
0;" class=3D"styled-by-prettify">//shared variable is visible</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br> =
</span><span style=3D"color: #008;" class=3D"styled-by-pretti=
fy">using</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">namespace<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> shared</sp=
an><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> <br>&nbs=
p; </span><span style=3D"color: #008;" class=3D"styled-by-pret=
tify">void</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
</span><span style=3D"color: #606;" class=3D"styled-by-prettify">Function_=
2</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: #800;" class=3D"styled-b=
y-prettify">//use special variable</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br> </span><span =
style=3D"color: #008;" class=3D"styled-by-prettify">int</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> variable</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> <br> &nbs=
p;</span><span style=3D"color: #008;" class=3D"styled-by-prettify">void</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span =
style=3D"color: #606;" class=3D"styled-by-prettify">Function_3</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">(){</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br> &nb=
sp; </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: #80=
0;" class=3D"styled-by-prettify">//shared variable is visible</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br> =
</span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">using</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pretti=
fy">namespace</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> shared</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"s=
tyled-by-prettify">}</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"><br> </span><span style=3D"color=
: #800;" class=3D"styled-by-prettify">//use special variable</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"><br> =
</span><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">int</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> var=
iable</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"><br> &nb=
sp; </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>=
</div></code></div><br><a href=3D"http://ncomputers.org/content/code.php?sr=
c=3Dsuggestions/nested%20namespaces%20classes.cpp">http://ncomputers.org/co=
ntent/code.php?src=3Dsuggestions/nested%20namespaces%20classes.cpp</a><br><=
/code></section></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_1_863438724.1413846345953--
.
Author: =?UTF-8?Q?David_Rodr=C3=ADguez_Ibeas?= <dibeas@ieee.org>
Date: Mon, 20 Oct 2014 22:55:24 -0400
Raw View
--001a113ecb6e7ce5780505e5f66a
Content-Type: text/plain; charset=UTF-8
Personally I prefer to have variables live in the smallest scope possible
as it makes reasoning about the code simpler to the programmer. It also
makes it simpler for an optimizer to reason about the lifetime of the
variables and often helps with optimizations.
From the description it is not clear to me whether you want to have
separate subgroups of members (whose lifetime is still controlled by the
lifetime of the complete object) or else you just want this as a shorthand
not to have to create the separate variables. For the former there is no
ideal solution, but I have not faced that as a problem that is not solved
with refactoring. If it is the latter, it is simpler and better to make
the variables local to each function.
David
On Mon, Oct 20, 2014 at 6:58 PM, <contact@ncomputers.org> wrote:
> I recognize that I don't have neither the enough experience and the enough
> knowledge to write a proposal with high probabilities to become standard
> and to be considered seriously by the international ISO/ANSI C++ committee.
>
> But I come here, I come to you as a customer. I am a customer of the
> ISO/ANSI C++ programming language, because I use it. I write computer codes
> using this language. I consume its words. I come here and share my
> suggestions with the intention to improve the product, the amazing C++
> programming language.
>
> Because if the ISO/ANSI C++ committee's erudites (all of you), decide to
> act as provider and hear me as a customer, you can gain some ideas to
> improve the product, the C++ programming language. To improve it could ease
> the life not only of the programmers while they write codes consuming its
> words, but also of every living being of the earth, because technology is
> today a very important support of our lifes.
>
> For your comments, your time, your patience and your help, that at the end
> become contributions, which I want to turn into solutions: I am infinite
> thankful to all of you!
>
> Nested namespaces by classes It is possible to nest a namespace inside
> another namespace.
>
> Classes, structs and unions are also namespaces, despite they have other
> purpose.
>
> Theoretically it should be possible to nest namespaces inside classes,
> structs and unions, what could be very useful.
>
> *For example:*
>
> When several class members require the same variables, it could be useful
> for the programmer to use *nested namespaces* to avoid the re-declaration
> of the same variables.
>
> It can also help compilers to optimize the code.
>
> Personally I like to avoid the re-declaration of the same variables inside
> different scopes, because sometimes they are too much.
>
> I don't like either let them easily accessible.
>
> When it is easy to access them, it is possible to use them accidentally,
> what can cause problems, which sometimes require hours to find, because
> they are hard to see.
>
> Without *nested namespaces by classes*, I do prefer to re-declare the
> same variables inside each scope to avoid confusions, despite it is an
> avoidable tedious task.
>
> On these cases, it would be easier to write: using namespace name; inside
> the scope than to re-declare the same variables again.
>
> It would also ease the identifying of scopes with shared variables.
>
> Other reason to suggest this improvement is that it would allow to mix *nested
> namespaces* with templates.
>
> *Downloads: *nested namespaces classes.cpp
> <http://ncomputers.org/download/code/suggestions/nested%20namespaces%20classes.cpp>
>
> template<typename Typename>
> struct Struct{
> namespace shared{
> Typename variable;
> }
>
> Struct():
> shared::variable(0)
> {}
>
> void Function_1(){
> //shared variable is visible
> using namespace shared;
> }
>
> void Function_2(){
> //use special variable
> int variable;
> }
>
> void Function_3(){
> {
> //shared variable is visible
> using namespace shared;
> }
> //use special variable
> int variable;
> }
> };
>
> Last modified: 2014 - Oct - 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
> email to std-proposals+unsubscribe@isocpp.org.
> To post to this group, send email to std-proposals@isocpp.org.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>
--
---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
--001a113ecb6e7ce5780505e5f66a
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Personally I prefer to have variables live in the smallest=
scope possible as it makes reasoning about the code simpler to the program=
mer. It also makes it simpler for an optimizer to reason about the lifetime=
of the variables and often helps with optimizations.<div><br></div><div>Fr=
om the description it is not clear to me whether you want to have separate =
subgroups of members (whose lifetime is still controlled by the lifetime of=
the complete object) or else you just want this as a shorthand not to have=
to create the separate variables. For the former there is no ideal solutio=
n, but I have not faced that as a problem that is not solved with refactori=
ng.=C2=A0 If it is the latter, it is simpler and better to make the variabl=
es local to each function.</div><div><br></div><div>=C2=A0 =C2=A0 David</di=
v></div><div class=3D"gmail_extra"><br><div class=3D"gmail_quote">On Mon, O=
ct 20, 2014 at 6:58 PM, <span dir=3D"ltr"><<a href=3D"mailto:contact@nc=
omputers.org" target=3D"_blank">contact@ncomputers.org</a>></span> wrote=
:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-le=
ft:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">I recognize that I don=
't have neither the enough experience and the enough knowledge to write=
a proposal with high probabilities to become standard and to be considered=
seriously by the international ISO/ANSI C++ committee.<br><br>But I come h=
ere, I come to you as a customer. I am a customer of the ISO/ANSI C++ progr=
amming language, because I use it. I write computer codes using this langua=
ge. I consume its words. I come here and share my suggestions with the inte=
ntion to improve the product, the amazing C++ programming language.<br><br>=
Because if the ISO/ANSI C++ committee's erudites (all of you), decide t=
o act as provider and hear me as a customer, you can gain some ideas to imp=
rove the product, the C++ programming language. To improve it could ease th=
e life not only of the programmers while they write codes consuming its wor=
ds, but also of every living being of the earth, because technology is toda=
y a very important support of our lifes.<br><br>For your comments, your tim=
e, your patience and your help, that at the end become contributions, which=
I want to turn into solutions: I am infinite thankful to all of you!<br><b=
r><h1>Nested namespaces by classes</h1>
It is possible to nest a namespace inside another namespace.<br><br>
Classes, structs and unions are also namespaces, despite they have other pu=
rpose.<br><br>
Theoretically it should be possible to nest namespaces inside classes, stru=
cts and unions, what could be very useful.<br><br>
<b>For example:</b><br><br>
When several class members require the same variables, it could be useful f=
or the programmer to use <b>nested namespaces</b> to avoid the re-declarati=
on of the same variables.<br><br>
It can also help compilers to optimize the code.<br><br>
Personally I like to avoid the re-declaration of the same variables=20
inside different scopes, because sometimes they are too much.<br><br>
I don't like either let them easily accessible.<br><br>
When it is easy to access them, it is possible to use them accidentally,
what can cause problems, which sometimes require hours to find, because
they are hard to see.<br><br>
Without <b>nested namespaces by classes</b>, I do prefer to re-declare the =
same variables inside each scope to avoid confusions, despite it is an avoi=
dable tedious task.<br><br>
On these cases, it would be easier to write: <code><span>using namespace</s=
pan> name;</code> inside the scope than to re-declare the same variables ag=
ain.<br><br>
It would also ease the identifying of scopes with shared variables.<br><br>
Other reason to suggest this improvement is that it would allow to mix <b>n=
ested namespaces</b> with templates.<br><br>
<b>Downloads: </b><a href=3D"http://ncomputers.org/download/code/suggestion=
s/nested%20namespaces%20classes.cpp" target=3D"_blank">nested namespaces cl=
asses.cpp</a><br><br>
<u></u><code>
<div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,18=
7);border-style:solid;border-width:1px;word-wrap:break-word"><code><div><sp=
an style=3D"color:#008">template</span><span style=3D"color:#660"><</spa=
n><span style=3D"color:#008">typename</span><span style=3D"color:#000"> </s=
pan><span style=3D"color:#606">Typename</span><span style=3D"color:#660">&g=
t;</span><span style=3D"color:#000"><br></span><span style=3D"color:#008">s=
truct</span><span style=3D"color:#000"> </span><span style=3D"color:#606">S=
truct</span><span style=3D"color:#660">{</span><span style=3D"color:#000"><=
br>=C2=A0 =C2=A0 =C2=A0</span><span style=3D"color:#008">namespace</span><s=
pan style=3D"color:#000"> shared</span><span style=3D"color:#660">{</span><=
span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0</span><spa=
n style=3D"color:#606">Typename</span><span style=3D"color:#000"> variable<=
/span><span style=3D"color:#660">;</span><span style=3D"color:#000"><br>=C2=
=A0 =C2=A0 =C2=A0</span><span style=3D"color:#660">}</span><span style=3D"c=
olor:#000"><br>=C2=A0<br>=C2=A0 =C2=A0 =C2=A0</span><span style=3D"color:#6=
06">Struct</span><span style=3D"color:#660">():</span><span style=3D"color:=
#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0shared</span><span style=3D"col=
or:#660">::</span><span style=3D"color:#000">variable</span><span style=3D"=
color:#660">(</span><span style=3D"color:#066">0</span><span style=3D"color=
:#660">)</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0</span><s=
pan style=3D"color:#660">{}</span><span style=3D"color:#000"><br>=C2=A0<br>=
=C2=A0 =C2=A0 =C2=A0</span><span style=3D"color:#008">void</span><span styl=
e=3D"color:#000"> </span><span style=3D"color:#606">Function_1</span><span =
style=3D"color:#660">(){</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0=
=C2=A0 =C2=A0 =C2=A0</span><span style=3D"color:#800">//shared variable is=
visible</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0</span><span style=3D"color:#008">using</span><span style=3D"color:#0=
00"> </span><span style=3D"color:#008">namespace</span><span style=3D"color=
:#000"> shared</span><span style=3D"color:#660">;</span><span style=3D"colo=
r:#000"><br>=C2=A0 =C2=A0 =C2=A0</span><span style=3D"color:#660">}</span><=
span style=3D"color:#000"><br>=C2=A0<br>=C2=A0 =C2=A0 =C2=A0</span><span st=
yle=3D"color:#008">void</span><span style=3D"color:#000"> </span><span styl=
e=3D"color:#606">Function_2</span><span style=3D"color:#660">(){</span><spa=
n style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0</span><span s=
tyle=3D"color:#800">//use special variable</span><span style=3D"color:#000"=
><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0</span><span style=3D"color:#008">in=
t</span><span style=3D"color:#000"> variable</span><span style=3D"color:#66=
0">;</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0</span><span =
style=3D"color:#660">}</span><span style=3D"color:#000"><br>=C2=A0<br>=C2=
=A0 =C2=A0 =C2=A0</span><span style=3D"color:#008">void</span><span style=
=3D"color:#000"> </span><span style=3D"color:#606">Function_3</span><span s=
tyle=3D"color:#660">(){</span><span style=3D"color:#000"><br>=C2=A0 =C2=A0 =
=C2=A0 =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 =C2=A0 =C2=A0 =C2=A0</span>=
<span style=3D"color:#800">//shared variable is visible</span><span style=
=3D"color:#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0</span>=
<span style=3D"color:#008">using</span><span style=3D"color:#000"> </span><=
span style=3D"color:#008">namespace</span><span style=3D"color:#000"> share=
d</span><span style=3D"color:#660">;</span><span style=3D"color:#000"><br>=
=C2=A0 =C2=A0 =C2=A0 =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 =C2=A0</span><s=
pan style=3D"color:#800">//use special variable</span><span style=3D"color:=
#000"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0</span><span style=3D"color:#00=
8">int</span><span style=3D"color:#000"> variable</span><span style=3D"colo=
r:#660">;</span><span style=3D"color:#000"><br></span><span style=3D"color:=
#000">=C2=A0 =C2=A0 =C2=A0</span><span style=3D"color:#660">}</span><span s=
tyle=3D"color:#000"><br></span><span style=3D"color:#660">};</span><span st=
yle=3D"color:#000"> </span></div></code></div><br></code><u></u>Last modifi=
ed: 2014 - Oct - 20 <br></div><span class=3D"HOEnZb"><font color=3D"#888888=
">
<p></p>
-- <br>
<br>
--- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</font></span></blockquote></div><br></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
--001a113ecb6e7ce5780505e5f66a--
.
Author: contact@ncomputers.org
Date: Mon, 20 Oct 2014 21:07:45 -0700 (PDT)
Raw View
------=_Part_4007_1907017720.1413864465698
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Thank you very much for your time and your answer!
From the description it is not clear to me whether you want to have=20
> separate subgroups of members (whose lifetime is still controlled by the=
=20
> lifetime of the complete object) or else you just want this as a shorthan=
d=20
> not to have to create the separate variables. For the former there is no=
=20
> ideal solution, but I have not faced that as a problem that is not solved=
=20
> with refactoring. If it is the latter, it is simpler and better to make=
=20
> the variables local to each function.
Separate subgroups of members (whose lifetime is still controlled by the=20
lifetime of the complete object).
For example: a temporary vector used by all members at different runtimes.
El lunes, 20 de octubre de 2014 21:55:26 UTC-5, David Rodr=C3=ADguez Ibeas=
=20
escribi=C3=B3:
>
> Personally I prefer to have variables live in the smallest scope possible=
=20
> as it makes reasoning about the code simpler to the programmer. It also=
=20
> makes it simpler for an optimizer to reason about the lifetime of the=20
> variables and often helps with optimizations.
>
> From the description it is not clear to me whether you want to have=20
> separate subgroups of members (whose lifetime is still controlled by the=
=20
> lifetime of the complete object) or else you just want this as a shorthan=
d=20
> not to have to create the separate variables. For the former there is no=
=20
> ideal solution, but I have not faced that as a problem that is not solved=
=20
> with refactoring. If it is the latter, it is simpler and better to make=
=20
> the variables local to each function.
>
> David
>
> On Mon, Oct 20, 2014 at 6:58 PM, <con...@ncomputers.org <javascript:>>=20
> wrote:
>
>> I recognize that I don't have neither the enough experience and the=20
>> enough knowledge to write a proposal with high probabilities to become=
=20
>> standard and to be considered seriously by the international ISO/ANSI C+=
+=20
>> committee.
>>
>> But I come here, I come to you as a customer. I am a customer of the=20
>> ISO/ANSI C++ programming language, because I use it. I write computer co=
des=20
>> using this language. I consume its words. I come here and share my=20
>> suggestions with the intention to improve the product, the amazing C++=
=20
>> programming language.
>>
>> Because if the ISO/ANSI C++ committee's erudites (all of you), decide to=
=20
>> act as provider and hear me as a customer, you can gain some ideas to=20
>> improve the product, the C++ programming language. To improve it could e=
ase=20
>> the life not only of the programmers while they write codes consuming it=
s=20
>> words, but also of every living being of the earth, because technology i=
s=20
>> today a very important support of our lifes.
>>
>> For your comments, your time, your patience and your help, that at the=
=20
>> end become contributions, which I want to turn into solutions: I am=20
>> infinite thankful to all of you!
>>
>> Nested namespaces by classes It is possible to nest a namespace inside=
=20
>> another namespace.
>>
>> Classes, structs and unions are also namespaces, despite they have other=
=20
>> purpose.
>>
>> Theoretically it should be possible to nest namespaces inside classes,=
=20
>> structs and unions, what could be very useful.
>>
>> *For example:*
>>
>> When several class members require the same variables, it could be usefu=
l=20
>> for the programmer to use *nested namespaces* to avoid the=20
>> re-declaration of the same variables.
>>
>> It can also help compilers to optimize the code.
>>
>> Personally I like to avoid the re-declaration of the same variables=20
>> inside different scopes, because sometimes they are too much.
>>
>> I don't like either let them easily accessible.
>>
>> When it is easy to access them, it is possible to use them accidentally,=
=20
>> what can cause problems, which sometimes require hours to find, because=
=20
>> they are hard to see.
>>
>> Without *nested namespaces by classes*, I do prefer to re-declare the=20
>> same variables inside each scope to avoid confusions, despite it is an=
=20
>> avoidable tedious task.
>>
>> On these cases, it would be easier to write: using namespace name;=20
>> inside the scope than to re-declare the same variables again.
>>
>> It would also ease the identifying of scopes with shared variables.
>>
>> Other reason to suggest this improvement is that it would allow to mix *=
nested=20
>> namespaces* with templates.
>>
>> *Downloads: *nested namespaces classes.cpp=20
>> <http://ncomputers.org/download/code/suggestions/nested%20namespaces%20c=
lasses.cpp>
>>
>> template<typename Typename>
>> struct Struct{
>> namespace shared{
>> Typename variable;
>> }
>> =20
>> Struct():
>> shared::variable(0)
>> {}
>> =20
>> void Function_1(){
>> //shared variable is visible
>> using namespace shared;
>> }
>> =20
>> void Function_2(){
>> //use special variable
>> int variable;
>> }
>> =20
>> void Function_3(){
>> {
>> //shared variable is visible
>> using namespace shared;
>> }
>> //use special variable
>> int variable;
>> }
>> };=20
>>
>> Last modified: 2014 - Oct - 20=20
>>
>> --=20
>>
>> ---=20
>> You received this message because you are subscribed to the Google Group=
s=20
>> "ISO C++ Standard - Future Proposals" group.
>> To unsubscribe from this group and stop receiving emails from it, send a=
n=20
>> email to std-proposal...@isocpp.org <javascript:>.
>> To post to this group, send email to std-pr...@isocpp.org <javascript:>.
>> Visit this group at=20
>> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>>
>
>
--=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
------=_Part_4007_1907017720.1413864465698
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Thank you very much for your time and your answer!<br><br>=
<blockquote style=3D"margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(=
204, 204, 204); padding-left: 1ex;" class=3D"gmail_quote">From the descript=
ion it is not clear to me whether you want to have=20
separate subgroups of members (whose lifetime is still controlled by the
lifetime of the complete object) or else you just want this as a=20
shorthand not to have to create the separate variables. For the former=20
there is no ideal solution, but I have not faced that as a problem that=20
is not solved with refactoring. If it is the latter, it is simpler an=
d=20
better to make the variables local to each function.</blockquote><div><br>S=
eparate subgroups of members (whose lifetime is still controlled by the
lifetime of the complete object).<br><br>For example: a temporary vector u=
sed by all members at different runtimes.<br></div><br>El lunes, 20 de octu=
bre de 2014 21:55:26 UTC-5, David Rodr=C3=ADguez Ibeas escribi=C3=B3:<block=
quote 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">Personally I prefer=
to have variables live in the smallest scope possible as it makes reasonin=
g about the code simpler to the programmer. It also makes it simpler for an=
optimizer to reason about the lifetime of the variables and often helps wi=
th optimizations.<div><br></div><div>From the description it is not clear t=
o me whether you want to have separate subgroups of members (whose lifetime=
is still controlled by the lifetime of the complete object) or else you ju=
st want this as a shorthand not to have to create the separate variables. F=
or the former there is no ideal solution, but I have not faced that as a pr=
oblem that is not solved with refactoring. If it is the latter, it is=
simpler and better to make the variables local to each function.</div><div=
><br></div><div> David</div></div><div><br><div class=3D"gmail=
_quote">On Mon, Oct 20, 2014 at 6:58 PM, <span dir=3D"ltr"><<a href=3D"=
javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"7IXaZB4G5_kJ" onmou=
sedown=3D"this.href=3D'javascript:';return true;" onclick=3D"this.href=3D'j=
avascript:';return true;">con...@ncomputers.org</a>></span> wrote:<br><b=
lockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px =
#ccc solid;padding-left:1ex"><div dir=3D"ltr">I recognize that I don't have=
neither the enough experience and the enough knowledge to write a proposal=
with high probabilities to become standard and to be considered seriously =
by the international ISO/ANSI C++ committee.<br><br>But I come here, I come=
to you as a customer. I am a customer of the ISO/ANSI C++ programming lang=
uage, because I use it. I write computer codes using this language. I consu=
me its words. I come here and share my suggestions with the intention to im=
prove the product, the amazing C++ programming language.<br><br>Because if =
the ISO/ANSI C++ committee's erudites (all of you), decide to act as provid=
er and hear me as a customer, you can gain some ideas to improve the produc=
t, the C++ programming language. To improve it could ease the life not only=
of the programmers while they write codes consuming its words, but also of=
every living being of the earth, because technology is today a very import=
ant support of our lifes.<br><br>For your comments, your time, your patienc=
e and your help, that at the end become contributions, which I want to turn=
into solutions: I am infinite thankful to all of you!<br><br><h1>Nested na=
mespaces by classes</h1>
It is possible to nest a namespace inside another namespace.<br><br>
Classes, structs and unions are also namespaces, despite they have other pu=
rpose.<br><br>
Theoretically it should be possible to nest namespaces inside classes, stru=
cts and unions, what could be very useful.<br><br>
<b>For example:</b><br><br>
When several class members require the same variables, it could be useful f=
or the programmer to use <b>nested namespaces</b> to avoid the re-declarati=
on of the same variables.<br><br>
It can also help compilers to optimize the code.<br><br>
Personally I like to avoid the re-declaration of the same variables=20
inside different scopes, because sometimes they are too much.<br><br>
I don't like either let them easily accessible.<br><br>
When it is easy to access them, it is possible to use them accidentally,
what can cause problems, which sometimes require hours to find, because
they are hard to see.<br><br>
Without <b>nested namespaces by classes</b>, I do prefer to re-declare the =
same variables inside each scope to avoid confusions, despite it is an avoi=
dable tedious task.<br><br>
On these cases, it would be easier to write: <code><span>using namespace</s=
pan> name;</code> inside the scope than to re-declare the same variables ag=
ain.<br><br>
It would also ease the identifying of scopes with shared variables.<br><br>
Other reason to suggest this improvement is that it would allow to mix <b>n=
ested namespaces</b> with templates.<br><br>
<b>Downloads: </b><a href=3D"http://ncomputers.org/download/code/suggestion=
s/nested%20namespaces%20classes.cpp" target=3D"_blank" onmousedown=3D"this.=
href=3D'http://www.google.com/url?q\75http%3A%2F%2Fncomputers.org%2Fdownloa=
d%2Fcode%2Fsuggestions%2Fnested%2520namespaces%2520classes.cpp\46sa\75D\46s=
ntz\0751\46usg\75AFQjCNEZabyug6p8MPgpL6s37p1twRGfRA';return true;" onclick=
=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fncomputers.org%=
2Fdownload%2Fcode%2Fsuggestions%2Fnested%2520namespaces%2520classes.cpp\46s=
a\75D\46sntz\0751\46usg\75AFQjCNEZabyug6p8MPgpL6s37p1twRGfRA';return true;"=
>nested namespaces classes.cpp</a><br><br>
<u></u><code>
<div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,18=
7);border-style:solid;border-width:1px;word-wrap:break-word"><code><div><sp=
an style=3D"color:#008">template</span><span style=3D"color:#660"><</spa=
n><span style=3D"color:#008">typename</span><span style=3D"color:#000"> </s=
pan><span style=3D"color:#606">Typename</span><span style=3D"color:#660">&g=
t;</span><span style=3D"color:#000"><br></span><span style=3D"color:#008">s=
truct</span><span style=3D"color:#000"> </span><span style=3D"color:#606">S=
truct</span><span style=3D"color:#660">{</span><span style=3D"color:#000"><=
br> </span><span style=3D"color:#008">namespace</span><s=
pan style=3D"color:#000"> shared</span><span style=3D"color:#660">{</span><=
span style=3D"color:#000"><br> </span><spa=
n style=3D"color:#606">Typename</span><span style=3D"color:#000"> variable<=
/span><span style=3D"color:#660">;</span><span style=3D"color:#000"><br>&nb=
sp; </span><span style=3D"color:#660">}</span><span style=3D"c=
olor:#000"><br> <br> </span><span style=3D"color:#6=
06">Struct</span><span style=3D"color:#660">():</span><span style=3D"color:=
#000"><br> shared</span><span style=3D"col=
or:#660">::</span><span style=3D"color:#000">variable</span><span style=3D"=
color:#660">(</span><span style=3D"color:#066">0</span><span style=3D"color=
:#660">)</span><span style=3D"color:#000"><br> </span><s=
pan style=3D"color:#660">{}</span><span style=3D"color:#000"><br> <br>=
</span><span style=3D"color:#008">void</span><span styl=
e=3D"color:#000"> </span><span style=3D"color:#606">Function_1</span><span =
style=3D"color:#660">(){</span><span style=3D"color:#000"><br> =
</span><span style=3D"color:#800">//shared variable is=
visible</span><span style=3D"color:#000"><br> &=
nbsp;</span><span style=3D"color:#008">using</span><span style=3D"color:#00=
0"> </span><span style=3D"color:#008">namespace</span><span style=3D"color:=
#000"> shared</span><span style=3D"color:#660">;</span><span style=3D"color=
:#000"><br> </span><span style=3D"color:#660">}</span><s=
pan style=3D"color:#000"><br> <br> </span><span sty=
le=3D"color:#008">void</span><span style=3D"color:#000"> </span><span style=
=3D"color:#606">Function_2</span><span style=3D"color:#660">(){</span><span=
style=3D"color:#000"><br> </span><span st=
yle=3D"color:#800">//use special variable</span><span style=3D"color:#000">=
<br> </span><span style=3D"color:#008">int=
</span><span style=3D"color:#000"> variable</span><span style=3D"color:#660=
">;</span><span style=3D"color:#000"><br> </span><span s=
tyle=3D"color:#660">}</span><span style=3D"color:#000"><br> <br> =
</span><span style=3D"color:#008">void</span><span style=3D"c=
olor:#000"> </span><span style=3D"color:#606">Function_3</span><span style=
=3D"color:#660">(){</span><span style=3D"color:#000"><br> &nbs=
p; </span><span style=3D"color:#660">{</span><span style=3D"co=
lor:#000"><br> </span><span =
style=3D"color:#800">//shared variable is visible</span><span style=3D"colo=
r:#000"><br> </span><span st=
yle=3D"color:#008">using</span><span style=3D"color:#000"> </span><span sty=
le=3D"color:#008">namespace</span><span style=3D"color:#000"> shared</span>=
<span style=3D"color:#660">;</span><span style=3D"color:#000"><br> &n=
bsp; </span><span style=3D"color:#660">}</span><span st=
yle=3D"color:#000"><br> </span><span style=
=3D"color:#800">//use special variable</span><span style=3D"color:#000"><br=
> </span><span style=3D"color:#008">int</s=
pan><span style=3D"color:#000"> variable</span><span style=3D"color:#660">;=
</span><span style=3D"color:#000"><br></span><span style=3D"color:#000">&nb=
sp; </span><span style=3D"color:#660">}</span><span style=3D"c=
olor:#000"><br></span><span style=3D"color:#660">};</span><span style=3D"co=
lor:#000"> </span></div></code></div><br></code><u></u>Last modified: 2014 =
- Oct - 20 <br></div><span><font color=3D"#888888">
<p></p>
-- <br>
<br>
--- <br>
You received this message because you are subscribed to the Google Groups "=
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"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"=
7IXaZB4G5_kJ" onmousedown=3D"this.href=3D'javascript:';return true;" onclic=
k=3D"this.href=3D'javascript:';return true;">std-proposal...@<wbr>isocpp.or=
g</a>.<br>
To post to this group, send email to <a href=3D"javascript:" target=3D"_bla=
nk" gdf-obfuscated-mailto=3D"7IXaZB4G5_kJ" onmousedown=3D"this.href=3D'java=
script:';return true;" onclick=3D"this.href=3D'javascript:';return true;">s=
td-pr...@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank" onmousedown=3D"this.href=3D'http://groups=
..google.com/a/isocpp.org/group/std-proposals/';return true;" onclick=3D"thi=
s.href=3D'http://groups.google.com/a/isocpp.org/group/std-proposals/';retur=
n true;">http://groups.google.com/a/<wbr>isocpp.org/group/std-<wbr>proposal=
s/</a>.<br>
</font></span></blockquote></div><br></div>
</blockquote></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_4007_1907017720.1413864465698--
.
Author: contact@ncomputers.org
Date: Mon, 20 Oct 2014 21:29:37 -0700 (PDT)
Raw View
------=_Part_1053_2131628514.1413865777375
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
For example:
struct A{
namespace shared{
vector<int>Vector;
}
=20
A(unsigned size):
shared::Vector(size)
{}
=20
void First(){
using namespace shared;
//Store temporary ints inside Vector
Second();
}
=20
void Second(){
using namespace shared;
//Store temporary ints inside Vector
Third();
}
=20
void Third(){
{
using namespace shared;
//Store temporary ints inside Vector
}
//Use special Vector
vector<unsigned>Vector;
}
};
El lunes, 20 de octubre de 2014 21:55:26 UTC-5, David Rodr=C3=ADguez Ibeas=
=20
escribi=C3=B3:
>
> Personally I prefer to have variables live in the smallest scope possible=
=20
> as it makes reasoning about the code simpler to the programmer. It also=
=20
> makes it simpler for an optimizer to reason about the lifetime of the=20
> variables and often helps with optimizations.
>
> From the description it is not clear to me whether you want to have=20
> separate subgroups of members (whose lifetime is still controlled by the=
=20
> lifetime of the complete object) or else you just want this as a shorthan=
d=20
> not to have to create the separate variables. For the former there is no=
=20
> ideal solution, but I have not faced that as a problem that is not solved=
=20
> with refactoring. If it is the latter, it is simpler and better to make=
=20
> the variables local to each function.
>
> David
>
> On Mon, Oct 20, 2014 at 6:58 PM, <con...@ncomputers.org <javascript:>>=20
> wrote:
>
>> I recognize that I don't have neither the enough experience and the=20
>> enough knowledge to write a proposal with high probabilities to become=
=20
>> standard and to be considered seriously by the international ISO/ANSI C+=
+=20
>> committee.
>>
>> But I come here, I come to you as a customer. I am a customer of the=20
>> ISO/ANSI C++ programming language, because I use it. I write computer co=
des=20
>> using this language. I consume its words. I come here and share my=20
>> suggestions with the intention to improve the product, the amazing C++=
=20
>> programming language.
>>
>> Because if the ISO/ANSI C++ committee's erudites (all of you), decide to=
=20
>> act as provider and hear me as a customer, you can gain some ideas to=20
>> improve the product, the C++ programming language. To improve it could e=
ase=20
>> the life not only of the programmers while they write codes consuming it=
s=20
>> words, but also of every living being of the earth, because technology i=
s=20
>> today a very important support of our lifes.
>>
>> For your comments, your time, your patience and your help, that at the=
=20
>> end become contributions, which I want to turn into solutions: I am=20
>> infinite thankful to all of you!
>>
>> Nested namespaces by classes It is possible to nest a namespace inside=
=20
>> another namespace.
>>
>> Classes, structs and unions are also namespaces, despite they have other=
=20
>> purpose.
>>
>> Theoretically it should be possible to nest namespaces inside classes,=
=20
>> structs and unions, what could be very useful.
>>
>> *For example:*
>>
>> When several class members require the same variables, it could be usefu=
l=20
>> for the programmer to use *nested namespaces* to avoid the=20
>> re-declaration of the same variables.
>>
>> It can also help compilers to optimize the code.
>>
>> Personally I like to avoid the re-declaration of the same variables=20
>> inside different scopes, because sometimes they are too much.
>>
>> I don't like either let them easily accessible.
>>
>> When it is easy to access them, it is possible to use them accidentally,=
=20
>> what can cause problems, which sometimes require hours to find, because=
=20
>> they are hard to see.
>>
>> Without *nested namespaces by classes*, I do prefer to re-declare the=20
>> same variables inside each scope to avoid confusions, despite it is an=
=20
>> avoidable tedious task.
>>
>> On these cases, it would be easier to write: using namespace name;=20
>> inside the scope than to re-declare the same variables again.
>>
>> It would also ease the identifying of scopes with shared variables.
>>
>> Other reason to suggest this improvement is that it would allow to mix *=
nested=20
>> namespaces* with templates.
>>
>> *Downloads: *nested namespaces classes.cpp=20
>> <http://ncomputers.org/download/code/suggestions/nested%20namespaces%20c=
lasses.cpp>
>>
>> template<typename Typename>
>> struct Struct{
>> namespace shared{
>> Typename variable;
>> }
>> =20
>> Struct():
>> shared::variable(0)
>> {}
>> =20
>> void Function_1(){
>> //shared variable is visible
>> using namespace shared;
>> }
>> =20
>> void Function_2(){
>> //use special variable
>> int variable;
>> }
>> =20
>> void Function_3(){
>> {
>> //shared variable is visible
>> using namespace shared;
>> }
>> //use special variable
>> int variable;
>> }
>> };=20
>>
>> Last modified: 2014 - Oct - 20=20
>>
>> --=20
>>
>> ---=20
>> You received this message because you are subscribed to the Google Group=
s=20
>> "ISO C++ Standard - Future Proposals" group.
>> To unsubscribe from this group and stop receiving emails from it, send a=
n=20
>> email to std-proposal...@isocpp.org <javascript:>.
>> To post to this group, send email to std-pr...@isocpp.org <javascript:>.
>> Visit this group at=20
>> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>>
>
>
--=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
------=_Part_1053_2131628514.1413865777375
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">For example:<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"> A</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"><br> </span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">namespace</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> shared</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"><br> vector</span><span style=3D"color: #08=
0;" class=3D"styled-by-prettify"><int></span><span style=3D"color: #6=
06;" class=3D"styled-by-prettify">Vector</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> <br> A</span><span style=
=3D"color: #660;" 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"> size</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">):</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br> shared</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=3D=
"color: #606;" class=3D"styled-by-prettify">Vector</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify">size</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"><br> </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">{}</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"><br> <br> </span><span style=3D"c=
olor: #008;" class=3D"styled-by-prettify">void</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #606;" cl=
ass=3D"styled-by-prettify">First</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(){</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br> </span><span style=3D"colo=
r: #008;" class=3D"styled-by-prettify">using</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" clas=
s=3D"styled-by-prettify">namespace</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> shared</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"><br> </span><span style=3D"color: #8=
00;" class=3D"styled-by-prettify">//Store temporary ints inside Vector</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"><br> &nbs=
p; </span><span style=3D"color: #606;" class=3D"styled-by-pre=
ttify">Second</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-pretti=
fy">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&=
nbsp; <br> </span><span style=3D"color: #008;" class=3D=
"styled-by-prettify">void</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> </span><span style=3D"color: #606;" class=3D"styled-by-pret=
tify">Second</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">(){</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&=
nbsp; </span><span style=3D"color: #008;" class=3D"sty=
led-by-prettify">using</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">namespace</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> shared</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: #800;" class=3D"styled-b=
y-prettify">//Store temporary ints inside Vector</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br> </spa=
n><span style=3D"color: #606;" class=3D"styled-by-prettify">Third</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">();</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"><br> </span><s=
pan 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">vo=
id</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span>=
<span style=3D"color: #606;" class=3D"styled-by-prettify">Third</span><span=
style=3D"color: #660;" class=3D"styled-by-prettify">(){</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br> &nb=
sp; </span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"><br> &nbs=
p; </span><span style=3D"color: #008;" class=3D=
"styled-by-prettify">using</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-pre=
ttify">namespace</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> shared</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&n=
bsp; </span><span style=3D"color: #800;"=
class=3D"styled-by-prettify">//Store temporary ints inside Vector</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"><br> &=
nbsp; </span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&n=
bsp; </span><span style=3D"color: #800;" class=3D"styl=
ed-by-prettify">//Use special Vector</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br> vector</span><spa=
n style=3D"color: #080;" class=3D"styled-by-prettify"><unsigned></spa=
n><span style=3D"color: #606;" class=3D"styled-by-prettify">Vector</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br> </span><sp=
an 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"co=
lor: #660;" class=3D"styled-by-prettify">};</span></div></code></div><br><b=
r><br>El lunes, 20 de octubre de 2014 21:55:26 UTC-5, David Rodr=C3=ADguez =
Ibeas escribi=C3=B3:<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">Personally I prefer to have variables live in the smallest scope p=
ossible as it makes reasoning about the code simpler to the programmer. It =
also makes it simpler for an optimizer to reason about the lifetime of the =
variables and often helps with optimizations.<div><br></div><div>From the d=
escription it is not clear to me whether you want to have separate subgroup=
s of members (whose lifetime is still controlled by the lifetime of the com=
plete object) or else you just want this as a shorthand not to have to crea=
te the separate variables. For the former there is no ideal solution, but I=
have not faced that as a problem that is not solved with refactoring. =
; If it is the latter, it is simpler and better to make the variables local=
to each function.</div><div><br></div><div> David</div></div>=
<div><br><div class=3D"gmail_quote">On Mon, Oct 20, 2014 at 6:58 PM, <span=
dir=3D"ltr"><<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-m=
ailto=3D"7IXaZB4G5_kJ" onmousedown=3D"this.href=3D'javascript:';return true=
;" onclick=3D"this.href=3D'javascript:';return true;">con...@ncomputers.org=
</a>></span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin=
:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"ltr">I=
recognize that I don't have neither the enough experience and the enough k=
nowledge to write a proposal with high probabilities to become standard and=
to be considered seriously by the international ISO/ANSI C++ committee.<br=
><br>But I come here, I come to you as a customer. I am a customer of the I=
SO/ANSI C++ programming language, because I use it. I write computer codes =
using this language. I consume its words. I come here and share my suggesti=
ons with the intention to improve the product, the amazing C++ programming =
language.<br><br>Because if the ISO/ANSI C++ committee's erudites (all of y=
ou), decide to act as provider and hear me as a customer, you can gain some=
ideas to improve the product, the C++ programming language. To improve it =
could ease the life not only of the programmers while they write codes cons=
uming its words, but also of every living being of the earth, because techn=
ology is today a very important support of our lifes.<br><br>For your comme=
nts, your time, your patience and your help, that at the end become contrib=
utions, which I want to turn into solutions: I am infinite thankful to all =
of you!<br><br><h1>Nested namespaces by classes</h1>
It is possible to nest a namespace inside another namespace.<br><br>
Classes, structs and unions are also namespaces, despite they have other pu=
rpose.<br><br>
Theoretically it should be possible to nest namespaces inside classes, stru=
cts and unions, what could be very useful.<br><br>
<b>For example:</b><br><br>
When several class members require the same variables, it could be useful f=
or the programmer to use <b>nested namespaces</b> to avoid the re-declarati=
on of the same variables.<br><br>
It can also help compilers to optimize the code.<br><br>
Personally I like to avoid the re-declaration of the same variables=20
inside different scopes, because sometimes they are too much.<br><br>
I don't like either let them easily accessible.<br><br>
When it is easy to access them, it is possible to use them accidentally,
what can cause problems, which sometimes require hours to find, because
they are hard to see.<br><br>
Without <b>nested namespaces by classes</b>, I do prefer to re-declare the =
same variables inside each scope to avoid confusions, despite it is an avoi=
dable tedious task.<br><br>
On these cases, it would be easier to write: <code><span>using namespace</s=
pan> name;</code> inside the scope than to re-declare the same variables ag=
ain.<br><br>
It would also ease the identifying of scopes with shared variables.<br><br>
Other reason to suggest this improvement is that it would allow to mix <b>n=
ested namespaces</b> with templates.<br><br>
<b>Downloads: </b><a href=3D"http://ncomputers.org/download/code/suggestion=
s/nested%20namespaces%20classes.cpp" target=3D"_blank" onmousedown=3D"this.=
href=3D'http://www.google.com/url?q\75http%3A%2F%2Fncomputers.org%2Fdownloa=
d%2Fcode%2Fsuggestions%2Fnested%2520namespaces%2520classes.cpp\46sa\75D\46s=
ntz\0751\46usg\75AFQjCNEZabyug6p8MPgpL6s37p1twRGfRA';return true;" onclick=
=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fncomputers.org%=
2Fdownload%2Fcode%2Fsuggestions%2Fnested%2520namespaces%2520classes.cpp\46s=
a\75D\46sntz\0751\46usg\75AFQjCNEZabyug6p8MPgpL6s37p1twRGfRA';return true;"=
>nested namespaces classes.cpp</a><br><br>
<u></u><code>
<div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,18=
7);border-style:solid;border-width:1px;word-wrap:break-word"><code><div><sp=
an style=3D"color:#008">template</span><span style=3D"color:#660"><</spa=
n><span style=3D"color:#008">typename</span><span style=3D"color:#000"> </s=
pan><span style=3D"color:#606">Typename</span><span style=3D"color:#660">&g=
t;</span><span style=3D"color:#000"><br></span><span style=3D"color:#008">s=
truct</span><span style=3D"color:#000"> </span><span style=3D"color:#606">S=
truct</span><span style=3D"color:#660">{</span><span style=3D"color:#000"><=
br> </span><span style=3D"color:#008">namespace</span><s=
pan style=3D"color:#000"> shared</span><span style=3D"color:#660">{</span><=
span style=3D"color:#000"><br> </span><spa=
n style=3D"color:#606">Typename</span><span style=3D"color:#000"> variable<=
/span><span style=3D"color:#660">;</span><span style=3D"color:#000"><br>&nb=
sp; </span><span style=3D"color:#660">}</span><span style=3D"c=
olor:#000"><br> <br> </span><span style=3D"color:#6=
06">Struct</span><span style=3D"color:#660">():</span><span style=3D"color:=
#000"><br> shared</span><span style=3D"col=
or:#660">::</span><span style=3D"color:#000">variable</span><span style=3D"=
color:#660">(</span><span style=3D"color:#066">0</span><span style=3D"color=
:#660">)</span><span style=3D"color:#000"><br> </span><s=
pan style=3D"color:#660">{}</span><span style=3D"color:#000"><br> <br>=
</span><span style=3D"color:#008">void</span><span styl=
e=3D"color:#000"> </span><span style=3D"color:#606">Function_1</span><span =
style=3D"color:#660">(){</span><span style=3D"color:#000"><br> =
</span><span style=3D"color:#800">//shared variable is=
visible</span><span style=3D"color:#000"><br> &=
nbsp;</span><span style=3D"color:#008">using</span><span style=3D"color:#00=
0"> </span><span style=3D"color:#008">namespace</span><span style=3D"color:=
#000"> shared</span><span style=3D"color:#660">;</span><span style=3D"color=
:#000"><br> </span><span style=3D"color:#660">}</span><s=
pan style=3D"color:#000"><br> <br> </span><span sty=
le=3D"color:#008">void</span><span style=3D"color:#000"> </span><span style=
=3D"color:#606">Function_2</span><span style=3D"color:#660">(){</span><span=
style=3D"color:#000"><br> </span><span st=
yle=3D"color:#800">//use special variable</span><span style=3D"color:#000">=
<br> </span><span style=3D"color:#008">int=
</span><span style=3D"color:#000"> variable</span><span style=3D"color:#660=
">;</span><span style=3D"color:#000"><br> </span><span s=
tyle=3D"color:#660">}</span><span style=3D"color:#000"><br> <br> =
</span><span style=3D"color:#008">void</span><span style=3D"c=
olor:#000"> </span><span style=3D"color:#606">Function_3</span><span style=
=3D"color:#660">(){</span><span style=3D"color:#000"><br> &nbs=
p; </span><span style=3D"color:#660">{</span><span style=3D"co=
lor:#000"><br> </span><span =
style=3D"color:#800">//shared variable is visible</span><span style=3D"colo=
r:#000"><br> </span><span st=
yle=3D"color:#008">using</span><span style=3D"color:#000"> </span><span sty=
le=3D"color:#008">namespace</span><span style=3D"color:#000"> shared</span>=
<span style=3D"color:#660">;</span><span style=3D"color:#000"><br> &n=
bsp; </span><span style=3D"color:#660">}</span><span st=
yle=3D"color:#000"><br> </span><span style=
=3D"color:#800">//use special variable</span><span style=3D"color:#000"><br=
> </span><span style=3D"color:#008">int</s=
pan><span style=3D"color:#000"> variable</span><span style=3D"color:#660">;=
</span><span style=3D"color:#000"><br></span><span style=3D"color:#000">&nb=
sp; </span><span style=3D"color:#660">}</span><span style=3D"c=
olor:#000"><br></span><span style=3D"color:#660">};</span><span style=3D"co=
lor:#000"> </span></div></code></div><br></code><u></u>Last modified: 2014 =
- Oct - 20 <br></div><span><font color=3D"#888888">
<p></p>
-- <br>
<br>
--- <br>
You received this message because you are subscribed to the Google Groups "=
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"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"=
7IXaZB4G5_kJ" onmousedown=3D"this.href=3D'javascript:';return true;" onclic=
k=3D"this.href=3D'javascript:';return true;">std-proposal...@<wbr>isocpp.or=
g</a>.<br>
To post to this group, send email to <a href=3D"javascript:" target=3D"_bla=
nk" gdf-obfuscated-mailto=3D"7IXaZB4G5_kJ" onmousedown=3D"this.href=3D'java=
script:';return true;" onclick=3D"this.href=3D'javascript:';return true;">s=
td-pr...@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank" onmousedown=3D"this.href=3D'http://groups=
..google.com/a/isocpp.org/group/std-proposals/';return true;" onclick=3D"thi=
s.href=3D'http://groups.google.com/a/isocpp.org/group/std-proposals/';retur=
n true;">http://groups.google.com/a/<wbr>isocpp.org/group/std-<wbr>proposal=
s/</a>.<br>
</font></span></blockquote></div><br></div>
</blockquote></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_1053_2131628514.1413865777375--
.
Author: Jens Maurer <Jens.Maurer@gmx.net>
Date: Tue, 21 Oct 2014 07:54:22 +0200
Raw View
On 10/21/2014 12:58 AM, contact@ncomputers.org wrote:
> Theoretically it should be possible to nest namespaces inside classes, structs and unions, what could be very useful.
Often, people use a naming convention such as m_ for member variables
(as opposed to local ones). While probably sub-optimal, it seems to
support a programming style such as yours.
I'd like to see examples where more than one namespace inside a class
is a useful tool.
If you use a nested (possibly anonymous [extension copied from C11]) struct,
which part of your desired use cases works and which part doesn't?
The short exposition you gave hasn't convinced me yet to get enough bang
for the buck it costs to integrate this into the standard.
Jens
--
---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
.
Author: Olaf van der Spek <olafvdspek@gmail.com>
Date: Tue, 21 Oct 2014 04:26:28 -0700 (PDT)
Raw View
------=_Part_4680_953556368.1413890788422
Content-Type: text/plain; charset=UTF-8
On Tuesday, October 21, 2014 7:54:27 AM UTC+2, Jens Maurer wrote:
>
> On 10/21/2014 12:58 AM, con...@ncomputers.org <javascript:> wrote:
> > Theoretically it should be possible to nest namespaces inside classes,
> structs and unions, what could be very useful.
>
> Often, people use a naming convention such as m_ for member variables
> (as opposed to local ones). While probably sub-optimal, it seems to
> support a programming style such as yours.
>
Why sub-optimal?
Another option is a trailing underscore.
I think Python or Ruby uses @member to access class members and recently I
was thinking: wouldn't that be handy in C++ too?
Distinct naming would no longer be required. Sometimes people are already
using this->member instead of just member.
>
> I'd like to see examples where more than one namespace inside a class
> is a useful tool.
>
> If you use a nested (possibly anonymous [extension copied from C11])
> struct,
> which part of your desired use cases works and which part doesn't?
>
> The short exposition you gave hasn't convinced me yet to get enough bang
> for the buck it costs to integrate this into the standard.
>
> Jens
>
--
---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_4680_953556368.1413890788422
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Tuesday, October 21, 2014 7:54:27 AM UTC+2, Jen=
s Maurer wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-=
left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">On 10/21/2014 1=
2:58 AM, <a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D=
"CYFt80GN3a0J" onmousedown=3D"this.href=3D'javascript:';return true;" oncli=
ck=3D"this.href=3D'javascript:';return true;">con...@ncomputers.org</a> wro=
te:
<br>> Theoretically it should be possible to nest namespaces inside clas=
ses, structs and unions, what could be very useful.
<br>
<br>Often, people use a naming convention such as m_ for member variables
<br>(as opposed to local ones). While probably sub-optimal, it seems =
to
<br>support a programming style such as yours.
<br></blockquote><div><br></div><div>Why sub-optimal?</div><div>Another opt=
ion is a trailing underscore.</div><div><br></div><div>I think Python or Ru=
by uses @member to access class members and recently I was thinking: wouldn=
't that be handy in C++ too?</div><div>Distinct naming would no longer be r=
equired. Sometimes people are already using this->member instead of just=
member.</div><div><br></div><div> </div><blockquote class=3D"gmail_qu=
ote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padd=
ing-left: 1ex;">
<br>I'd like to see examples where more than one namespace inside a class
<br>is a useful tool.
<br>
<br>If you use a nested (possibly anonymous [extension copied from C11]) st=
ruct,
<br>which part of your desired use cases works and which part doesn't?
<br>
<br>The short exposition you gave hasn't convinced me yet to get enough ban=
g
<br>for the buck it costs to integrate this into the standard.
<br>
<br>Jens
<br></blockquote></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_4680_953556368.1413890788422--
.
Author: Michael Bruck <bruck.michael@gmail.com>
Date: Tue, 21 Oct 2014 05:17:23 -0700 (PDT)
Raw View
------=_Part_4261_343456166.1413893843142
Content-Type: text/plain; charset=UTF-8
I have this issue from time to time with complex state machines where you
have logical blocks that need to interact with each other (i.e. not just
top-down communication from the parent to children). You can either
sequester them into separate structs and then wire it up with pointers back
and forth or you can use name prefixes. A simple example:
struct tetris_t
{
/* board */
void board_tick()
{
...
if (full) audio_play_sad_song();
}
int board_elems[10][10];
void board_on_boss_key();
/* audio */
void audio_play_sad_song() { if (audio_player &&
audio_player->ready) audio_player->play(audio_sad_song); }
void audio_on_boss_key();
Audioplayer * audio_player;
resource * audio_sad_song;
/* public */
void on_boss_key() { bord_on_boss_key(); audio_on_boss_key();}
};
You end up with ugly code where not only the struct but the implementation
of the board_/audio_ functions is full of redundant board_/audio_s. And
rarely are the names as short as that.
Instead you could write:
struct tetris_t
{
namespace board
{
void tick()
{
...
if (full) audio::play_sad_song();
}
int elems[10][10];
void on_boss_key();
}
namespace audio
{
void play_sad_song() { if (player && player->ready)
player->play(sad_song); }
void on_boss_key();
Audioplayer * player;
resource * sad_song;
}
/* public */
void on_boss_key() { board::on_boss_key(); audio::on_boss_key();}
};
Michael
On Tuesday, October 21, 2014 7:54:27 AM UTC+2, Jens Maurer wrote:
>
> On 10/21/2014 12:58 AM, con...@ncomputers.org <javascript:> wrote:
> > Theoretically it should be possible to nest namespaces inside classes,
> structs and unions, what could be very useful.
>
> I'd like to see examples where more than one namespace inside a class
> is a useful tool.
>
> Jens
>
--
---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_4261_343456166.1413893843142
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">I have this issue from time to time with complex state mac=
hines where you have logical blocks that need to interact with each other (=
i.e. not just top-down communication from the parent to children). You can =
either sequester them into separate structs and then wire it up with pointe=
rs back and forth or you can use name prefixes. A simple example:<div><br><=
/div><div>struct tetris_t</div><div>{</div><div> /* board */</=
div><div> void board_tick()</div><div> {</div><di=
v> ...</div><div> if =
(full) audio_play_sad_song();</div><div> }</div><div><br></div=
><div> int board_elems[10][10];</div><div><br></div><div> =
; void board_on_boss_key();</div><div><br></div><div> /=
* audio */</div><div> void audio_play_sad_song() { if (audio_p=
layer && audio_player->ready) audio_player->play(audio_s=
ad_song); }</div><div> void audio_on_boss_key();<br></div><div=
> Audioplayer * audio_player;</div><div> resource=
* audio_sad_song;</div><div><br></div><div> /* public */<br><=
/div><div> void on_boss_key() { bord_on_boss_key(); =
audio_on_boss_key();}</div><div>};<br><div><br></div><div>You end up with u=
gly code where not only the struct but the implementation of the board_/aud=
io_ functions is full of redundant board_/audio_s. And rarely are the names=
as short as that.</div><div><br></div><div>Instead you could write:</div><=
div><br></div><div><div>struct tetris_t</div><div>{</div><div> =
namespace board</div><div> {</div><div> &=
nbsp; void tick()</div><div> {</div><div> =
...</div><div>  =
; if (full) audio::play_sad_song();</div><div> &=
nbsp; }</div><div><br></div><div> int ele=
ms[10][10];</div><div><br></div><div> void on_bos=
s_key();</div><div> }</div><div><br></div><div> n=
amespace audio</div><div> {</div><div> &nb=
sp; void play_sad_song() { if (player && player->ready) pl=
ayer->play(sad_song); }</div><div> void on_bo=
ss_key();<br></div><div><div> Audioplayer * play=
er;</div><div> resource * sad_song;</div></div><=
div> }<br></div><div><br></div><div> /* public */=
<br></div><div> void on_boss_key() { board::on_boss_=
key(); audio::on_boss_key();}</div><div>};<br></div></div><div><br></div><d=
iv><br></div><div><br></div><div>Michael</div><div><br></div><div>On Tuesda=
y, October 21, 2014 7:54:27 AM UTC+2, Jens Maurer wrote:<blockquote class=
=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #cc=
c solid;padding-left: 1ex;">On 10/21/2014 12:58 AM, <a href=3D"javascript:"=
target=3D"_blank" gdf-obfuscated-mailto=3D"CYFt80GN3a0J" onmousedown=3D"th=
is.href=3D'javascript:';return true;" onclick=3D"this.href=3D'javascript:';=
return true;">con...@ncomputers.org</a> wrote:
<br>> Theoretically it should be possible to nest namespaces inside clas=
ses, structs and unions, what could be very useful.
<br>
<br>I'd like to see examples where more than one namespace inside a class
<br>is a useful tool.
<br><br>Jens
<br></blockquote></div></div></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_4261_343456166.1413893843142--
.
Author: contact@ncomputers.org
Date: Tue, 21 Oct 2014 10:47:40 -0700 (PDT)
Raw View
------=_Part_452_1607470876.1413913660793
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Jens,
Thank you very much for your answer.
If you use a nested (possibly anonymous [extension copied from C11])=20
> struct,=20
> which part of your desired use cases works and which part doesn't?=20
It is possible to make everything to work with nested structs, as Michael=
=20
said:
You end up with ugly code where not only the struct but the implementation=
=20
> of the board_/audio_ functions is full of redundant board_/audio_s. And=
=20
> rarely are the names as short as that.
That's why I would prefer *nested namespaces* instead of nested structs.=20
Other disadvantage of nested structs is that it will be necessary to write=
=20
the name of the object's variable, what could be avoided with nested=20
namespaces. For example:
struct A{
struct Nested{
unsigned Unsigned;
int Signed;
}
Nested o_Nested;
=20
A(){
o_Nested.Unsigned;
o_Nested.Signed;
}
=20
void B(){
o_Nested.Unsigned;
o_Nested.Signed;
}
};=20
With *nested namespaces*:
struct A{
namespace Nested{
unsigned Unsigned;
int Signed;
}
=20
A(){
using namespace Nested;
Unsigned;
Signed;
}
=20
void B(){
using namespace Nested;
Unsigned;
Signed;
}
};
One advantage of *nested namespaces* would be: To group members by=20
namespace.
I can give you more examples, which would require some time to be posted=20
here. I'm waiting to finish my newest code, publish it under GNU License=20
and then post fragments of the code as example.
I am posting here a draft, which I use to test this code.
It is: GCI.cpp (Graph Coloring Implementation)
Note, that each member below of void color() require some P's.
Best Regards,
PF, ncomputers.org
#include<cstdlib>
#include<iostream>
#include"GC.cpp"
using namespace std;
template<typename P,typename E,typename U>
struct GCI:private GC<P,E>{
U const a,z;
GCI(P const v,bool const*const ad,P const cn,P const tn,U const tm):
GC<P,E>(v,ad),
a(time(0)),z(a+tm)
{
srand(a);
seed();
this->st(cn,tn);
height();
//this->sv();
color();
colors();
this->sh();
height();
color();
colors();
//this->sv();
//Test:
color();
colors();
height();
//edges();
conflicts();
vertices();
cout<<time(0)-a<<endl;
}
public:
void solve(){
this->sv();
//Try again?
}
private:
P cr(P p,P c)const{
//Propose other color?
return c;
}
private:
void color(){
P c,p,q;
for(c=3Dp=3D0;p<this->pn;p++)c=3Dc>(q=3D(this->ws->pv+p)->c->n)?c:q=
;
cout<<c<<" colors"<<endl;
}
void colors(){
P p;
//Variables
for(p=3D0;p<this->pn;p++)cout<<(this->ws->pv+p)->c->n<<',';cout<<en=
dl;
}
void conflicts(){
E e;
P p;
//Variables
=20
for(e=3Dp=3D0;p<this->pn;p++)e+=3D(this->ws->pv+p)->c->h->n,cout<<(this->ws=
->pv+p)->c->h->n<<',';cout<<endl;
cout<<e/2<<endl;
}
void edges(){
P p,*p0,*p1;
//Variables
for(p=3D0;p<this->pn;p++){
cout<<p<<' '<<*(this->en+p)<<':';
=20
for(p0=3D*(this->ea+p),p1=3D*(this->ez+p);p0<p1;)cout<<*p0++<<',';cout<<end=
l;
}
}
void height(){
cout<<"Height: "<<this->ws->h<<endl;
}
void seed(){
P p,*p0,*p1;
//Variables
=20
for(p0=3Dthis->ra;p0<this->rz;p0++)p=3D*(p1=3Dp0+rand()%(this->rz-p0)),*p1=
=3D*p0,*p0=3Dp;
}
void vertices(){
P*p0,*p1;
//Variables
cout<<this->rn<<" vertices with edges:";
for(p0=3Dthis->ra,p1=3Dthis->rz;p0<p1;)cout<<*p0++<<',';cout<<endl;
cout<<this->in<<" vertices without edges:";
for(p0=3Dthis->ia,p1=3Dthis->iz;p0<p1;)cout<<*--p1<<',';cout<<endl;
}
};
El martes, 21 de octubre de 2014 00:54:27 UTC-5, Jens Maurer escribi=C3=B3:
>
> On 10/21/2014 12:58 AM, con...@ncomputers.org <javascript:> wrote:=20
> > Theoretically it should be possible to nest namespaces inside classes,=
=20
> structs and unions, what could be very useful.=20
>
> Often, people use a naming convention such as m_ for member variables=20
> (as opposed to local ones). While probably sub-optimal, it seems to=20
> support a programming style such as yours.=20
>
> I'd like to see examples where more than one namespace inside a class=20
> is a useful tool.=20
>
> If you use a nested (possibly anonymous [extension copied from C11])=20
> struct,=20
> which part of your desired use cases works and which part doesn't?=20
>
> The short exposition you gave hasn't convinced me yet to get enough bang=
=20
> for the buck it costs to integrate this into the standard.=20
>
> Jens=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
------=_Part_452_1607470876.1413913660793
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Jens,<br><br>Thank you very much for your answer.<br><br><=
blockquote style=3D"margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(2=
04, 204, 204); padding-left: 1ex;" class=3D"gmail_quote">If you use a neste=
d (possibly anonymous [extension copied from C11]) struct,
<br>which part of your desired use cases works and which part doesn't?
</blockquote><div><br>It is possible to make everything to work with nested=
structs, as Michael said:<br><br><blockquote style=3D"margin: 0px 0px 0px =
0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class=
=3D"gmail_quote">You end up with ugly code where not only the struct but th=
e=20
implementation of the board_/audio_ functions is full of redundant=20
board_/audio_s. And rarely are the names as short as that.</blockquote><div=
><br>That's why I would prefer <b>nested namespaces</b> instead of nested s=
tructs. Other disadvantage of nested structs is that it will be necessary t=
o write the name of the object's variable, what could be avoided with neste=
d namespaces. For example:<br><br><div class=3D"prettyprint" style=3D"backg=
round-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-s=
tyle: solid; border-width: 1px; word-wrap: break-word;"><code class=3D"pret=
typrint"><div class=3D"subprettyprint"><span style=3D"color: #008;" class=
=3D"styled-by-prettify">struct</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> A</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> </span><span style=3D"color: #008;" class=3D"styled-by=
-prettify">struct</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">Ne=
sted</span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"><br> &nbs=
p; </span><span style=3D"color: #008;" class=3D"styled-by-pre=
ttify">unsigned</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">Unsi=
gned</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"><br> &nbs=
p; </span><span style=3D"color: #008;" class=3D"styled-by-pre=
ttify">int</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
</span><span style=3D"color: #606;" class=3D"styled-by-prettify">Signed</s=
pan><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><span =
style=3D"color: #000;" class=3D"styled-by-prettify"><br><br> <=
/span><span style=3D"color: #606;" class=3D"styled-by-prettify">Nested</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> o_Nested</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"><br> <br>&nb=
sp; A</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">(){</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&=
nbsp; o_Nested</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">.</span><span style=3D"color: #606;" class=3D"styl=
ed-by-prettify">Unsigned</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"><br></span><span style=3D"color: #000;" class=3D"styled-by-prettify"><=
code class=3D"prettyprint"><span style=3D"color: #000;" class=3D"styled-by-=
prettify"> o_Nested</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">.</span><span style=3D"c=
olor: #606;" class=3D"styled-by-prettify">Signed</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"><br></span></code> </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> <br> &nbs=
p; </span><span style=3D"color: #008;" class=3D"styled-by-prettify">void</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> B</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">(){</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br> &nb=
sp; o_Nested</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">.</span><span style=3D"color: #606;" class=3D"styled-by-prettify">Unsigne=
d</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify"></span><br><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><code class=3D"prettypri=
nt"><span style=3D"color: #000;" class=3D"styled-by-prettify"><code class=
=3D"prettyprint"><span style=3D"color: #000;" class=3D"styled-by-prettify">=
o_Nested</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">.</span><span style=3D"color: #606=
;" class=3D"styled-by-prettify">Signed</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"><br></span></code></span></code> </span><sp=
an 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"co=
lor: #660;" class=3D"styled-by-prettify">};</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"> </span></div></code></div><br>With <b>nes=
ted namespaces</b>:<br><br><div class=3D"prettyprint" style=3D"background-c=
olor: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: s=
olid; border-width: 1px; word-wrap: break-word;"><code class=3D"prettyprint=
"><div class=3D"subprettyprint"><code class=3D"prettyprint"><span style=3D"=
color: #008;" class=3D"styled-by-prettify"><code class=3D"prettyprint"><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">struct</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> A</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> namespace</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"co=
lor: #606;" class=3D"styled-by-prettify">Nested</span><span style=3D"color:=
#660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br> </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"> </span><span style=3D"colo=
r: #606;" class=3D"styled-by-prettify">Unsigned</span><span style=3D"color:=
#660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br> </span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">int</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #6=
06;" class=3D"styled-by-prettify">Signed</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"></span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"><br> <br> A</span><span style=3D"color:=
#660;" class=3D"styled-by-prettify">(){</span><span style=3D"color: #000;"=
class=3D"styled-by-prettify"></span></code></span></code><code class=3D"pr=
ettyprint"><span style=3D"color: #008;" class=3D"styled-by-prettify"><code =
class=3D"prettyprint"><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"><code class=3D"prettyprint"><code class=3D"prettyprint"><span style=3D=
"color: #008;" class=3D"styled-by-prettify"><code class=3D"prettyprint"><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"><br> &nbs=
p; using namespace Nested;<br> =
</span><span style=3D"color: #606;" class=3D"styled-by-prettify">Uns=
igned</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"></span><br><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"><code class=3D"prett=
yprint"><span style=3D"color: #000;" class=3D"styled-by-prettify"><code cla=
ss=3D"prettyprint"><span style=3D"color: #000;" class=3D"styled-by-prettify=
"> </span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify"></span><span style=3D"color: #606;"=
class=3D"styled-by-prettify">Signed</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></code></span></code></span></code></span></code></=
code></span><span style=3D"color: #000;" class=3D"styled-by-prettify"><code=
class=3D"prettyprint"><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"><br></span></code> </span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"><br> <br> </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">void</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> B</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">(){</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br> us=
ing namespace Nested;<br> </span><span style=3D"=
color: #606;" class=3D"styled-by-prettify">Unsigned</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"></span><br><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><code class=3D"prettyprint"><span style=3D"color:=
#000;" class=3D"styled-by-prettify"><code class=3D"prettyprint"><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> &nb=
sp; </span><span style=3D"color: #660;" class=3D"styled-by=
-prettify"></span><span style=3D"color: #606;" class=3D"styled-by-prettify"=
>Signed</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span><=
/code></span></code> </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></code></span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"></span></code><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"></span></div></code></div><br>One advantage of <b>nested namesp=
aces</b> would be: To group members by namespace.<br><br>I can give you mor=
e examples, which would require some time to be posted here. I'm waiting to=
finish my newest code, publish it under GNU License and then post fragment=
s of the code as example.<br><br>I am posting here a draft, which I use to =
test this code.<br><br>It is: GCI.cpp (Graph Coloring Implementation)<br><b=
r>Note, that each member below of <span style=3D"background-color: rgb(204,=
204, 204);"><span style=3D"color: rgb(0, 0, 0);"><span style=3D"font-famil=
y: courier new,monospace;">void color()</span></span></span> require some P=
's.<br><br>Best Regards,<br><br>PF, ncomputers.org<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: #606;" class=3D"styled-by-prettify">#include<cstdlib><br>#=
include<iostream><br>#include"GC.cpp"<br>using namespace std;<br><br>=
template<typename P,typename E,typename U><br>struct GCI:private GC&l=
t;P,E>{<br> U const a,z;<br><br> GCI=
(P const v,bool const*const ad,P const cn,P const tn,U const tm):<br> =
GC<P,E>(v,ad),<br> a(time(0)),z(a+tm)<=
br> {<br> srand(a);<=
br> seed();<br> &nbs=
p; this->st(cn,tn);<br> =
height();<br> //this->sv();<br>&nb=
sp; color();<br> &nb=
sp; colors();<br> this->sh();=
<br> height();<br> &=
nbsp; color();<br> colors(=
);<br> //this->sv();<br>  =
; //Test:<br> =
color();<br> colors();<br>  =
; height();<br> &nbs=
p; //edges();<br> conflicts();<br>&nbs=
p; vertices();<br> &=
nbsp; cout<<time(0)-a<<endl;<br> }<br>p=
ublic:<br> void solve(){<br> &nbs=
p; this->sv();<br> //Try agai=
n?<br> }<br>private:<br> P cr(P p,P c)c=
onst{<br> //Propose other color?<br>&n=
bsp; return c;<br> }<br>pr=
ivate:<br> void color(){<br> &nbs=
p; P c,p,q;<br> for(c=3Dp=3D0;p&=
lt;this->pn;p++)c=3Dc>(q=3D(this->ws->pv+p)->c->n)?c:q;<b=
r> cout<<c<<" colors"<&=
lt;endl;<br> }<br> void colors(){<br>&n=
bsp; P p;<br> =
//Variables<br> for(p=3D0;p<=
this->pn;p++)cout<<(this->ws->pv+p)->c->n<<',';c=
out<<endl;<br> }<br> void conflic=
ts(){<br> E e;<br> &=
nbsp; P p;<br> //Variables=
<br> for(e=3Dp=3D0;p<this->pn;p+=
+)e+=3D(this->ws->pv+p)->c->h->n,cout<<(this->ws-&g=
t;pv+p)->c->h->n<<',';cout<<endl;<br> &nbs=
p; cout<<e/2<<endl;<br> }<b=
r> void edges(){<br> =
P p,*p0,*p1;<br> //Variables<br> =
; for(p=3D0;p<this->pn;p++){<br> =
cout<<p<<' '=
<<*(this->en+p)<<':';<br> &nbs=
p; for(p0=3D*(this->ea+p),p1=3D*(this->ez+p);p0<=
;p1;)cout<<*p0++<<',';cout<<endl;<br> &=
nbsp; }<br> }<br> void heig=
ht(){<br> cout<<"Height: "<&l=
t;this->ws->h<<endl;<br> }<br> &n=
bsp;void seed(){<br> P p,*p0,*p1;<br>&=
nbsp; //Variables<br> &nbs=
p; for(p0=3Dthis->ra;p0<this->rz;p0++)p=3D*(p1=3Dp0+ra=
nd()%(this->rz-p0)),*p1=3D*p0,*p0=3Dp;<br> }<br> =
void vertices(){<br> P*p0=
,*p1;<br> //Variables<br> =
cout<<this->rn<<" vertices with edg=
es:";<br> for(p0=3Dthis->ra,p1=3Dth=
is->rz;p0<p1;)cout<<*p0++<<',';cout<<endl;<br> =
; cout<<this->in<<" vertices =
without edges:";<br> for(p0=3Dthis->=
;ia,p1=3Dthis->iz;p0<p1;)cout<<*--p1<<',';cout<<end=
l;<br> }<br>};<br></span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"></span></div></code></div><br><br></div></div><br=
>El martes, 21 de octubre de 2014 00:54:27 UTC-5, Jens Maurer escribi=C3=B3=
:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;bo=
rder-left: 1px #ccc solid;padding-left: 1ex;">On 10/21/2014 12:58 AM, <a hr=
ef=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"CYFt80GN3a0J"=
onmousedown=3D"this.href=3D'javascript:';return true;" onclick=3D"this.hre=
f=3D'javascript:';return true;">con...@ncomputers.org</a> wrote:
<br>> Theoretically it should be possible to nest namespaces inside clas=
ses, structs and unions, what could be very useful.
<br>
<br>Often, people use a naming convention such as m_ for member variables
<br>(as opposed to local ones). While probably sub-optimal, it seems =
to
<br>support a programming style such as yours.
<br>
<br>I'd like to see examples where more than one namespace inside a class
<br>is a useful tool.
<br>
<br>If you use a nested (possibly anonymous [extension copied from C11]) st=
ruct,
<br>which part of your desired use cases works and which part doesn't?
<br>
<br>The short exposition you gave hasn't convinced me yet to get enough ban=
g
<br>for the buck it costs to integrate this into the standard.
<br>
<br>Jens
<br></blockquote></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_452_1607470876.1413913660793--
.
Author: contact@ncomputers.org
Date: Tue, 21 Oct 2014 10:50:40 -0700 (PDT)
Raw View
------=_Part_317_2124797823.1413913840414
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Michael,
Thank you very much for your answer.
I think that your example is very good.
PF, ncomputers.org
El martes, 21 de octubre de 2014 07:17:23 UTC-5, Michael Bruck escribi=C3=
=B3:
>
> I have this issue from time to time with complex state machines where you=
=20
> have logical blocks that need to interact with each other (i.e. not just=
=20
> top-down communication from the parent to children). You can either=20
> sequester them into separate structs and then wire it up with pointers ba=
ck=20
> and forth or you can use name prefixes. A simple example:
>
> struct tetris_t
> {
> /* board */
> void board_tick()
> {
> ...
> if (full) audio_play_sad_song();
> }
>
> int board_elems[10][10];
>
> void board_on_boss_key();
>
> /* audio */
> void audio_play_sad_song() { if (audio_player &&=20
> audio_player->ready) audio_player->play(audio_sad_song); }
> void audio_on_boss_key();
> Audioplayer * audio_player;
> resource * audio_sad_song;
>
> /* public */
> void on_boss_key() { bord_on_boss_key(); audio_on_boss_key();}
> };
>
> You end up with ugly code where not only the struct but the implementatio=
n=20
> of the board_/audio_ functions is full of redundant board_/audio_s. And=
=20
> rarely are the names as short as that.
>
> Instead you could write:
>
> struct tetris_t
> {
> namespace board
> {
> void tick()
> {
> ...
> if (full) audio::play_sad_song();
> }
>
> int elems[10][10];
>
> void on_boss_key();
> }
>
> namespace audio
> {
> void play_sad_song() { if (player && player->ready)=20
> player->play(sad_song); }
> void on_boss_key();
> Audioplayer * player;
> resource * sad_song;
> }
>
> /* public */
> void on_boss_key() { board::on_boss_key(); audio::on_boss_key();}
> };
>
>
>
> Michael
>
> On Tuesday, October 21, 2014 7:54:27 AM UTC+2, Jens Maurer wrote:
>>
>> On 10/21/2014 12:58 AM, con...@ncomputers.org wrote:=20
>> > Theoretically it should be possible to nest namespaces inside classes,=
=20
>> structs and unions, what could be very useful.=20
>>
>> I'd like to see examples where more than one namespace inside a class=20
>> is a useful tool.=20
>>
>> Jens=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
------=_Part_317_2124797823.1413913840414
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Michael,<br><br>Thank you very much for your answer.<br><b=
r>I think that your example is very good.<br><br>PF, ncomputers.org<br><br>=
El martes, 21 de octubre de 2014 07:17:23 UTC-5, Michael Bruck escribi=C3=
=B3:<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">I have th=
is issue from time to time with complex state machines where you have logic=
al blocks that need to interact with each other (i.e. not just top-down com=
munication from the parent to children). You can either sequester them into=
separate structs and then wire it up with pointers back and forth or you c=
an use name prefixes. A simple example:<div><br></div><div>struct tetris_t<=
/div><div>{</div><div> /* board */</div><div> voi=
d board_tick()</div><div> {</div><div> &nb=
sp; ...</div><div> if (full) audio_play_sad_song=
();</div><div> }</div><div><br></div><div> int bo=
ard_elems[10][10];</div><div><br></div><div> void board_on_bos=
s_key();</div><div><br></div><div> /* audio */</div><div> =
; void audio_play_sad_song() { if (audio_player && audio_pla=
yer->ready) audio_<wbr>player->play(audio_sad_song); }</div><div=
> void audio_on_boss_key();<br></div><div> Audiop=
layer * audio_player;</div><div> resource * audio_sad_song;</d=
iv><div><br></div><div> /* public */<br></div><div> &nbs=
p; void on_boss_key() { bord_on_boss_key(); audio_on_boss_key();}=
</div><div>};<br><div><br></div><div>You end up with ugly code where not on=
ly the struct but the implementation of the board_/audio_ functions is full=
of redundant board_/audio_s. And rarely are the names as short as that.</d=
iv><div><br></div><div>Instead you could write:</div><div><br></div><div><d=
iv>struct tetris_t</div><div>{</div><div> namespace board</div=
><div> {</div><div> void tick()</di=
v><div> {</div><div> =
...</div><div> if (f=
ull) audio::play_sad_song();</div><div> }</div><=
div><br></div><div> int elems[10][10];</div><div=
><br></div><div> void on_boss_key();</div><div>&n=
bsp; }</div><div><br></div><div> namespace audio</div><=
div> {</div><div> void play_sad_son=
g() { if (player && player->ready) player->play(sad_son=
g); }</div><div> void on_boss_key();<br></div><d=
iv><div> Audioplayer * player;</div><div> =
resource * sad_song;</div></div><div> }<b=
r></div><div><br></div><div> /* public */<br></div><div> =
void on_boss_key() { board::on_boss_key(); audio::on_boss=
_key();}</div><div>};<br></div></div><div><br></div><div><br></div><div><br=
></div><div>Michael</div><div><br></div><div>On Tuesday, October 21, 2014 7=
:54:27 AM UTC+2, Jens Maurer wrote:<blockquote class=3D"gmail_quote" style=
=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"=
>On 10/21/2014 12:58 AM, <a>con...@ncomputers.org</a> wrote:
<br>> Theoretically it should be possible to nest namespaces inside clas=
ses, structs and unions, what could be very useful.
<br>
<br>I'd like to see examples where more than one namespace inside a class
<br>is a useful tool.
<br><br>Jens
<br></blockquote></div></div></div></blockquote></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_317_2124797823.1413913840414--
.
Author: contact@ncomputers.org
Date: Tue, 21 Oct 2014 11:02:39 -0700 (PDT)
Raw View
------=_Part_4741_1101184185.1413914559423
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Olaf,
Thank you very much for your answer.
One of the advantages of nested namespaces would be to group members. This=
=20
can make the code more readable and understandable. For example:
struct A{
namespace Group_A{
//Variables
}
namespace Group_B{
//Variables
}
namespace Group_C{
//Variables
}
=20
A(){
//Group_A is visible
using namespace Group_A;
}
=20
void Function(){
//Local variables
//Group_B is visible
using namespace Group_B;
{
//Group_A is visible
using namespace Group_A;
}
{
//Group_C is visible
using namespace Group_C;
}
//Group_B still visible
}
=20
~A(){
//Group_C is visible
using namespace Group_C;
}
};
It could also help naming conventions. Instead of using prefixes like: 'm_'=
,=20
'n_', 'o_', etc. use *nested namespaces*: namespace m, namepspace n,=20
namespace o. So would the members have names according to the naming=20
conventions, for example: m::integer, n::unsigned, o::string.
PF, ncomputers.org
El martes, 21 de octubre de 2014 06:26:28 UTC-5, Olaf van der Spek escribi=
=C3=B3:
>
>
>
> On Tuesday, October 21, 2014 7:54:27 AM UTC+2, Jens Maurer wrote:
>>
>> On 10/21/2014 12:58 AM, con...@ncomputers.org wrote:=20
>> > Theoretically it should be possible to nest namespaces inside classes,=
=20
>> structs and unions, what could be very useful.=20
>>
>> Often, people use a naming convention such as m_ for member variables=20
>> (as opposed to local ones). While probably sub-optimal, it seems to=20
>> support a programming style such as yours.=20
>>
>
> Why sub-optimal?
> Another option is a trailing underscore.
>
> I think Python or Ruby uses @member to access class members and recently =
I=20
> was thinking: wouldn't that be handy in C++ too?
> Distinct naming would no longer be required. Sometimes people are already=
=20
> using this->member instead of just member.
>
> =20
>
>>
>> I'd like to see examples where more than one namespace inside a class=20
>> is a useful tool.=20
>>
>> If you use a nested (possibly anonymous [extension copied from C11])=20
>> struct,=20
>> which part of your desired use cases works and which part doesn't?=20
>>
>> The short exposition you gave hasn't convinced me yet to get enough bang=
=20
>> for the buck it costs to integrate this into the standard.=20
>>
>> Jens=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
------=_Part_4741_1101184185.1413914559423
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Olaf,<br><br>Thank you very much for your answer.<br><br>O=
ne of the advantages of nested namespaces would be to group members. This c=
an make the code more readable and understandable. For example:<br><br><div=
class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); borde=
r-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; word-w=
rap: break-word;"><code class=3D"prettyprint"><div class=3D"subprettyprint"=
><span style=3D"color: #008;" class=3D"styled-by-prettify">struct</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> A</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">namespace</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color=
: #606;" class=3D"styled-by-prettify">Group_A</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br> </span><span styl=
e=3D"color: #800;" class=3D"styled-by-prettify">//Variables</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"><br> </span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">}</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"><br> </span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">namespace</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #606;" class=3D"styled-by-prettify">Group_B</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: #800;" class=3D"styled-by-prettify">//Variables</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">namespace<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #606;" class=3D"styled-by-prettify">Group_C</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: #800;" class=3D"styled-by-prettify">//Variable=
s</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> =
<br> A</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">(){</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"><br> </span><span style=3D"color: #800=
;" class=3D"styled-by-prettify">//Group_A is visible</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"><br> <=
/span><span style=3D"color: #008;" class=3D"styled-by-prettify">using</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">namespace</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"col=
or: #606;" class=3D"styled-by-prettify">Group_A</span><span style=3D"color:=
#660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br> </span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">}</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"><br> <br> </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">Function</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 s=
tyle=3D"color: #800;" class=3D"styled-by-prettify">//Local variables</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"><br> =
</span><span style=3D"color: #800;" class=3D"styled-by-prett=
ify">//Group_B is visible</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br> </span><span style=3D"color:=
#008;" class=3D"styled-by-prettify">using</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">namespace</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=3D"style=
d-by-prettify">Group_B</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> </span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"><br> </span><span =
style=3D"color: #800;" class=3D"styled-by-prettify">//Group_A is visible</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"><br> &n=
bsp; </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">using</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-=
prettify">namespace</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">=
Group_A</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br> &=
nbsp; </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"style=
d-by-prettify"><br> </span><span s=
tyle=3D"color: #800;" class=3D"styled-by-prettify">//Group_C is visible</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"><br> &nb=
sp; </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">using</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-=
prettify">namespace</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">=
Group_C</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br> &=
nbsp; </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: #800;" class=
=3D"styled-by-prettify">//Group_B still visible</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> <br> <=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">~</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify">A</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">(){</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"><br> </s=
pan><span style=3D"color: #800;" class=3D"styled-by-prettify">//Group_C is =
visible</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br=
> </span><span style=3D"color: #008;" class=3D"s=
tyled-by-prettify">using</span><span style=3D"color: #000;" class=3D"styled=
-by-prettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prett=
ify">namespace</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> </span><span style=3D"color: #606;" class=3D"styled-by-prettify">Group=
_C</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></span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">};</span><span style=3D"=
color: #000;" class=3D"styled-by-prettify"><br></span></div></code></div><b=
r>It could also help naming conventions. Instead of using prefixes like: <s=
pan style=3D"font-family: courier new,monospace;"><span style=3D"background=
-color: rgb(238, 238, 238);">'m_', 'n_', 'o_'</span>,</span> etc. use <b>ne=
sted namespaces</b>: <span style=3D"background-color: rgb(238, 238, 238);">=
<span style=3D"font-family: courier new,monospace;">namespace m, namepspace=
n, namespace o</span></span>. So would the members have names according to=
the naming conventions, for example: <span style=3D"background-color: rgb(=
238, 238, 238);"><span style=3D"font-family: courier new,monospace;">m::int=
eger, n::unsigned, o::string</span>.</span><br><br>PF, ncomputers.org<br><b=
r>El martes, 21 de octubre de 2014 06:26:28 UTC-5, Olaf van der Spek escrib=
i=C3=B3:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0=
..8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><br><=
br>On Tuesday, October 21, 2014 7:54:27 AM UTC+2, Jens Maurer wrote:<blockq=
uote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-left:=
1px #ccc solid;padding-left:1ex">On 10/21/2014 12:58 AM, <a>con...@ncompute=
rs.org</a> wrote:
<br>> Theoretically it should be possible to nest namespaces inside clas=
ses, structs and unions, what could be very useful.
<br>
<br>Often, people use a naming convention such as m_ for member variables
<br>(as opposed to local ones). While probably sub-optimal, it seems =
to
<br>support a programming style such as yours.
<br></blockquote><div><br></div><div>Why sub-optimal?</div><div>Another opt=
ion is a trailing underscore.</div><div><br></div><div>I think Python or Ru=
by uses @member to access class members and recently I was thinking: wouldn=
't that be handy in C++ too?</div><div>Distinct naming would no longer be r=
equired. Sometimes people are already using this->member instead of just=
member.</div><div><br></div><div> </div><blockquote class=3D"gmail_qu=
ote" style=3D"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding=
-left:1ex">
<br>I'd like to see examples where more than one namespace inside a class
<br>is a useful tool.
<br>
<br>If you use a nested (possibly anonymous [extension copied from C11]) st=
ruct,
<br>which part of your desired use cases works and which part doesn't?
<br>
<br>The short exposition you gave hasn't convinced me yet to get enough ban=
g
<br>for the buck it costs to integrate this into the standard.
<br>
<br>Jens
<br></blockquote></div></blockquote></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_4741_1101184185.1413914559423--
.
Author: Jens Maurer <Jens.Maurer@gmx.net>
Date: Tue, 21 Oct 2014 20:23:10 +0200
Raw View
On 10/21/2014 07:47 PM, contact@ncomputers.org wrote:
> void vertices(){
> P*p0,*p1;
> //Variables
> cout<<this->rn<<" vertices with edges:";
> for(p0=this->ra,p1=this->rz;p0<p1;)cout<<*p0++<<',';cout<<endl;
> cout<<this->in<<" vertices without edges:";
> for(p0=this->ia,p1=this->iz;p0<p1;)cout<<*--p1<<',';cout<<endl;
I'd recommend investing in a space key. This is unreadable.
Thanks,
Jens
--
---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
.
Author: contact@ncomputers.org
Date: Tue, 21 Oct 2014 19:10:48 -0700 (PDT)
Raw View
------=_Part_5030_2101331580.1413943848108
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Jens,
Yes I accept that it is unreadable. I just copied and pasted the code from=
=20
the implementation that I use to test GC.cpp (Graph Coloring.cpp)
It is a draft.
When I have opportunity I will give you readable more real examples.
I was thinking today:
Depending on the development methodology I would use *nested namespaces*=20
for some purposes:
For prototyping I would surely use *nested namespaces* to declare member's=
=20
variables with the purpose to reduce the cost of prototypes avoiding=20
variables redeclaration inside each member's scope.
When writing a release version, like David, suggested, I would refactor the=
=20
prototype. After the refactoring *nested namespaces* could still be useful=
=20
to declare variables, whose lifetime is object's lifetime and to group them=
=20
can make the code more readable, understandable and maintainable.
PF, ncomputers.org
El martes, 21 de octubre de 2014 13:23:14 UTC-5, Jens Maurer escribi=C3=B3:
>
> On 10/21/2014 07:47 PM, con...@ncomputers.org <javascript:> wrote:=20
> > void vertices(){=20
> > P*p0,*p1;=20
> > //Variables=20
> > cout<<this->rn<<" vertices with edges:";=20
> > for(p0=3Dthis->ra,p1=3Dthis->rz;p0<p1;)cout<<*p0++<<',';cout<<e=
ndl;=20
> > cout<<this->in<<" vertices without edges:";=20
> > for(p0=3Dthis->ia,p1=3Dthis->iz;p0<p1;)cout<<*--p1<<',';cout<<e=
ndl;=20
>
> I'd recommend investing in a space key. This is unreadable.=20
>
> Thanks,=20
> Jens=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
------=_Part_5030_2101331580.1413943848108
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Jens,<br><br>Yes I accept that it is unreadable. I just co=
pied and pasted the code from the implementation that I use to test GC.cpp =
(Graph Coloring.cpp)<br><br>It is a draft.<br><br>When I have opportunity I=
will give you readable more real examples.<br><br>I was thinking today:<br=
><br>Depending on the development methodology I would use <b>nested namespa=
ces</b> for some purposes:<br><br>For prototyping I would surely use <b>nes=
ted namespaces</b> to declare member's variables with the purpose to reduce=
the cost of prototypes avoiding variables redeclaration inside each member=
's scope.<br><br>When writing a release version, like David, suggested, I w=
ould refactor the prototype. After the refactoring <b>nested namespaces</b>=
could still be useful to declare variables, whose lifetime is object's lif=
etime and to group them can make the code more readable, understandable and=
maintainable.<br><br>PF, ncomputers.org<br><br>El martes, 21 de octubre de=
2014 13:23:14 UTC-5, Jens Maurer escribi=C3=B3:<blockquote class=3D"gmail_=
quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;pa=
dding-left: 1ex;">On 10/21/2014 07:47 PM, <a href=3D"javascript:" target=3D=
"_blank" gdf-obfuscated-mailto=3D"IVp9Z6NZWNwJ" onmousedown=3D"this.href=3D=
'javascript:';return true;" onclick=3D"this.href=3D'javascript:';return tru=
e;">con...@ncomputers.org</a> wrote:
<br>> void vertices(){
<br>> P*p0,*p1;
<br>> //Variables
<br>> cout<<this->rn<<" verti=
ces with edges:";
<br>> for(p0=3Dthis->ra,p1=3Dthis->rz;=
<wbr>p0<p1;)cout<<*p0++<<',';cout<<<wbr>endl;
<br>> cout<<this->in<<" verti=
ces without edges:";
<br>> for(p0=3Dthis->ia,p1=3Dthis->iz;=
<wbr>p0<p1;)cout<<*--p1<<',';cout<<<wbr>endl;
<br>
<br>I'd recommend investing in a space key. This is unreadable.
<br>
<br>Thanks,
<br>Jens
<br>
<br></blockquote></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_5030_2101331580.1413943848108--
.
Author: contact@ncomputers.org
Date: Tue, 21 Oct 2014 19:12:42 -0700 (PDT)
Raw View
------=_Part_927_499491935.1413943962554
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Quick correction:
When I have opportunity I will give you readable more real examples.
>
More readable.=20
El martes, 21 de octubre de 2014 21:10:48 UTC-5, con...@ncomputers.org=20
escribi=C3=B3:
>
> Jens,
>
> Yes I accept that it is unreadable. I just copied and pasted the code fro=
m=20
> the implementation that I use to test GC.cpp (Graph Coloring.cpp)
>
> It is a draft.
>
> When I have opportunity I will give you readable more real examples.
>
> I was thinking today:
>
> Depending on the development methodology I would use *nested namespaces*=
=20
> for some purposes:
>
> For prototyping I would surely use *nested namespaces* to declare=20
> member's variables with the purpose to reduce the cost of prototypes=20
> avoiding variables redeclaration inside each member's scope.
>
> When writing a release version, like David, suggested, I would refactor=
=20
> the prototype. After the refactoring *nested namespaces* could still be=
=20
> useful to declare variables, whose lifetime is object's lifetime and to=
=20
> group them can make the code more readable, understandable and maintainab=
le.
>
> PF, ncomputers.org
>
> El martes, 21 de octubre de 2014 13:23:14 UTC-5, Jens Maurer escribi=C3=
=B3:
>>
>> On 10/21/2014 07:47 PM, con...@ncomputers.org wrote:=20
>> > void vertices(){=20
>> > P*p0,*p1;=20
>> > //Variables=20
>> > cout<<this->rn<<" vertices with edges:";=20
>> > for(p0=3Dthis->ra,p1=3Dthis->rz;p0<p1;)cout<<*p0++<<',';cout<<=
endl;=20
>> > cout<<this->in<<" vertices without edges:";=20
>> > for(p0=3Dthis->ia,p1=3Dthis->iz;p0<p1;)cout<<*--p1<<',';cout<<=
endl;=20
>>
>> I'd recommend investing in a space key. This is unreadable.=20
>>
>> Thanks,=20
>> Jens=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
------=_Part_927_499491935.1413943962554
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Quick correction:<br><br><blockquote style=3D"margin: 0px =
0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex=
;" class=3D"gmail_quote">When I have opportunity I will give you readable m=
ore real examples.<br></blockquote><div><br>More readable. <br></div><br>El=
martes, 21 de octubre de 2014 21:10:48 UTC-5, con...@ncomputers.org escrib=
i=C3=B3:<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">Jens,=
<br><br>Yes I accept that it is unreadable. I just copied and pasted the co=
de from the implementation that I use to test GC.cpp (Graph Coloring.cpp)<b=
r><br>It is a draft.<br><br>When I have opportunity I will give you readabl=
e more real examples.<br><br>I was thinking today:<br><br>Depending on the =
development methodology I would use <b>nested namespaces</b> for some purpo=
ses:<br><br>For prototyping I would surely use <b>nested namespaces</b> to =
declare member's variables with the purpose to reduce the cost of prototype=
s avoiding variables redeclaration inside each member's scope.<br><br>When =
writing a release version, like David, suggested, I would refactor the prot=
otype. After the refactoring <b>nested namespaces</b> could still be useful=
to declare variables, whose lifetime is object's lifetime and to group the=
m can make the code more readable, understandable and maintainable.<br><br>=
PF, <a href=3D"http://ncomputers.org" target=3D"_blank" onmousedown=3D"this=
..href=3D'http://www.google.com/url?q\75http%3A%2F%2Fncomputers.org\46sa\75D=
\46sntz\0751\46usg\75AFQjCNGu9y3wXgJPa-68kCF9PEFnWBBJpQ';return true;" oncl=
ick=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fncomputers.o=
rg\46sa\75D\46sntz\0751\46usg\75AFQjCNGu9y3wXgJPa-68kCF9PEFnWBBJpQ';return =
true;">ncomputers.org</a><br><br>El martes, 21 de octubre de 2014 13:23:14 =
UTC-5, Jens Maurer escribi=C3=B3:<blockquote class=3D"gmail_quote" style=3D=
"margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex">On=
10/21/2014 07:47 PM, <a>con...@ncomputers.org</a> wrote:
<br>> void vertices(){
<br>> P*p0,*p1;
<br>> //Variables
<br>> cout<<this->rn<<" verti=
ces with edges:";
<br>> for(p0=3Dthis->ra,p1=3Dthis->rz;=
<wbr>p0<p1;)cout<<*p0++<<',';cout<<<wbr>endl;
<br>> cout<<this->in<<" verti=
ces without edges:";
<br>> for(p0=3Dthis->ia,p1=3Dthis->iz;=
<wbr>p0<p1;)cout<<*--p1<<',';cout<<<wbr>endl;
<br>
<br>I'd recommend investing in a space key. This is unreadable.
<br>
<br>Thanks,
<br>Jens
<br>
<br></blockquote></div></blockquote></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_927_499491935.1413943962554--
.
Author: contact@ncomputers.org
Date: Tue, 21 Oct 2014 21:52:25 -0700 (PDT)
Raw View
------=_Part_1020_587934273.1413953545676
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Jens,
I've found how to give you a better example.
I will only copy the declaration of the variables of my code. (Graph=20
Coloring.cpp)
A key property to prototyping is the fact that it is supposed to be done=20
> quickly.
I have been working on this code for more than three months. I make a=20
prototype, I change it, make a new, change it again, and so on. It would=20
help me a lot to have *nested namespaces*. Instead of declaring all=20
variables inside each function, I would declare it inside a *nested=20
namespace* (to avoid confusions if they were direct members of the object)=
=20
and when I have a final prototype, refactor the code.
(These are segments of functions (that run at different runtimes) of a real=
=20
code with a real application):
template<typename P,typename E>
class GC{
void function_1(){
C*c1,*c0,**cc0,**cc1;
P e,p,*p0,*p1;
V*v0;
}
=20
void function_2(){
C*c0,*c1,*c2,**cc0,**cc1;
H*h0,*h1,**hh0;
P e,p,*p0,*p1;
V*v0;
}
=20
void function_3(){
C*c0,*c1,*c2;
H*h0;
H***hhh0;
V*v0;
P e,*p0,*p1;
}
=20
void function_4(){
C*c0,*c1;
H**hh0;
P e,p,*p0,*p1;
V*v0;
}
=20
void function_5(){
C**cc0,**cc1;
}
=20
void function_6(){
H*h0,*h1,*h2;
P p,e,a;
P*p0;
H**hh0;
V**vv0;
}
=20
void function_7(){
C**cc0,**cc1;
H**hh0,**hh1;
}
};
Reference: http://en.wikipedia.org/wiki/Software_prototyping
El martes, 21 de octubre de 2014 13:23:14 UTC-5, Jens Maurer escribi=C3=B3:
>
> On 10/21/2014 07:47 PM, con...@ncomputers.org <javascript:> wrote:=20
> > void vertices(){=20
> > P*p0,*p1;=20
> > //Variables=20
> > cout<<this->rn<<" vertices with edges:";=20
> > for(p0=3Dthis->ra,p1=3Dthis->rz;p0<p1;)cout<<*p0++<<',';cout<<e=
ndl;=20
> > cout<<this->in<<" vertices without edges:";=20
> > for(p0=3Dthis->ia,p1=3Dthis->iz;p0<p1;)cout<<*--p1<<',';cout<<e=
ndl;=20
>
> I'd recommend investing in a space key. This is unreadable.=20
>
> Thanks,=20
> Jens=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
------=_Part_1020_587934273.1413953545676
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Jens,<br><br>I've found how to give you a better example.<=
br><br>I will only copy the declaration of the variables of my code. (Graph=
Coloring.cpp)<br><br><blockquote style=3D"margin: 0px 0px 0px 0.8ex; borde=
r-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class=3D"gmail_qu=
ote">A key property to prototyping is the fact that it is supposed to be do=
ne quickly.</blockquote><div><br>I have been working on this code for more =
than three months. I make a prototype, I change it, make a new, change it a=
gain, and so on. It would help me a lot to have <b>nested namespaces</b>. I=
nstead of declaring all variables inside each function, I would declare it =
inside a <b>nested namespace</b> (to avoid confusions if they were direct m=
embers of the object) and when I have a final prototype, refactor the code.=
<br><br>(These are segments of functions (that run at different runtimes) o=
f a real code with a real application):<br><br><div class=3D"prettyprint" s=
tyle=3D"background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 1=
87); 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">template</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify"><</span><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">typename</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> P</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">,</span><span style=3D"color: #008;" class=3D"styled-by-pr=
ettify">typename</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> E</span><span style=3D"color: #660;" class=3D"styled-by-prettify">&g=
t;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></sp=
an><span style=3D"color: #008;" class=3D"styled-by-prettify">class</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> GC</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 styl=
e=3D"color: #008;" class=3D"styled-by-prettify">void</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> function_1</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">(){</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"><br> C</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">*</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify">c1</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">,*</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify">c0</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">,**</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify">cc0</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">,**</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify">cc1</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br> =
P e</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify">p</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,*</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify">p0</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">,*</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">p1</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;"=
class=3D"styled-by-prettify"><br> V</span><span=
style=3D"color: #660;" class=3D"styled-by-prettify">*</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify">v0</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"><br> </span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">}</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br> <br> </span><span =
style=3D"color: #008;" class=3D"styled-by-prettify">void</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> function_2</span><span styl=
e=3D"color: #660;" class=3D"styled-by-prettify">(){</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br> C<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">*</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify">c0</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">,*</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify">c1</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">,*</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">c2</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">,**</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify">cc0</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">,**</span><span style=3D"color: #000;" class=3D"styled-by-prettify">cc1</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br> &nb=
sp; H</span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">*</span><span style=3D"color: #000;" class=3D"styled-by-prettify">h0</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">,*</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify">h1</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">,**</span><span style=3D"color:=
#000;" class=3D"styled-by-prettify">hh0</span><span style=3D"color: #660;"=
class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"><br> P e</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify">p</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">,*</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify">p0</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">,*</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify">p1</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br> &=
nbsp; V</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">*</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
">v0</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"><br> &nbs=
p; </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;" class=3D"styled-by-=
prettify">void</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> function_3</span><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">(){</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><b=
r> C</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">*</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify">c0</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">,*</span><span style=3D"color: #000;" class=3D"styled-by-prettify">c1</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">,*</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify">c2</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br> H</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">*</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify">h0</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"><br> H</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">***</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify">hhh0</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"><br> V</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">*</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify">v0</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"><br> P e</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">,*</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify">p0</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">,*</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify">p1</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"><br> </span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br> <br> </span><span style=3D=
"color: #008;" class=3D"styled-by-prettify">void</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> function_4</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">(){</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"><br> C</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">*</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">c0</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">,*</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify">c1</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br> H</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">**</span><span style=3D"color: #000;"=
class=3D"styled-by-prettify">hh0</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br> P e</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify">p</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">,*</span><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify">p0</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">,*</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
p1</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"><br> =
V</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">*</span><span style=3D"color: #000;" class=3D"styled-by-prettify">v0<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><sp=
an 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> <br=
> </span><span style=3D"color: #008;" class=3D"styled-by-prett=
ify">void</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
function_5</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
(){</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nb=
sp; C</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">**</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify">cc0</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>,**</span><span style=3D"color: #000;" class=3D"styled-by-prettify">cc1</s=
pan><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><span =
style=3D"color: #000;" class=3D"styled-by-prettify"><br> <br>&=
nbsp; </span><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">void</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> fu=
nction_6</span><span style=3D"color: #660;" class=3D"styled-by-prettify">()=
{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br> =
; H</span><span style=3D"color: #660;" class=3D"styled=
-by-prettify">*</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify">h0</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,*<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify">h1</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">,*</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify">h2</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"><br> P p</span><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">e</span><span style=3D"color=
: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify">a</span><span style=3D"color: #660;" class=3D"=
styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"><br> P</span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">*</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify">p0</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"><br> H</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">**</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">hh0</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"><br> V</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">**</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">vv0</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"><br> </span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">}</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"><br> <br> </span><span style=3D"color: #00=
8;" class=3D"styled-by-prettify">void</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> function_7</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">(){</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"><br> C</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">**</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify">cc0</span><span style=3D"color: #660;" =
class=3D"styled-by-prettify">,**</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">cc1</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"><br> H</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">**</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">hh0</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">,**</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify">hh1</span><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&n=
bsp; </span><span style=3D"color: #660;" class=3D"styled-by-prettify=
">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></s=
pan><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><br>Reference: <a href=3D"http://en.wikipedia.org/wiki/Softwa=
re_prototyping">http://en.wikipedia.org/wiki/Software_prototyping</a><br></=
div><br>El martes, 21 de octubre de 2014 13:23:14 UTC-5, Jens Maurer escrib=
i=C3=B3:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0=
..8ex;border-left: 1px #ccc solid;padding-left: 1ex;">On 10/21/2014 07:47 PM=
, <a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"IVp9Z6=
NZWNwJ" onmousedown=3D"this.href=3D'javascript:';return true;" onclick=3D"t=
his.href=3D'javascript:';return true;">con...@ncomputers.org</a> wrote:
<br>> void vertices(){
<br>> P*p0,*p1;
<br>> //Variables
<br>> cout<<this->rn<<" verti=
ces with edges:";
<br>> for(p0=3Dthis->ra,p1=3Dthis->rz;=
<wbr>p0<p1;)cout<<*p0++<<',';cout<<<wbr>endl;
<br>> cout<<this->in<<" verti=
ces without edges:";
<br>> for(p0=3Dthis->ia,p1=3Dthis->iz;=
<wbr>p0<p1;)cout<<*--p1<<',';cout<<<wbr>endl;
<br>
<br>I'd recommend investing in a space key. This is unreadable.
<br>
<br>Thanks,
<br>Jens
<br>
<br></blockquote></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_1020_587934273.1413953545676--
.
Author: =?UTF-8?Q?David_Rodr=C3=ADguez_Ibeas?= <dibeas@ieee.org>
Date: Wed, 22 Oct 2014 12:05:08 -0400
Raw View
--047d7bdc15d0a9da750506051cd2
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
When providing a motivating example, I would go the extra mile and provide
how this would look in the new design.
Other than that, the comments and examples lead me to think this is really
a couple of conflicting things... In this last example, all of the
variables are local to each function, while the modified design would make
them members of the class. This is an important change in the design, as it
makes that additional data persistent beyond the function call (additional
memory requirements) and prone to side effects from other functions. If one
function above calls another and it does not pass pointers or references to
its local variables it is clear both to the developer (understanding of
code) and the compiler (optimizing code) that the variable is not modified
externally. Once you move those local variables to the object, that is no
longer the case. Furthermore, it opens the door to subtle bugs where during
maintenance the called function starts modifying part of the temporary
state and affects the behavior of the callee.
Regarding lookup, and on the comments above that the use of nested types
(they really need not be nested, but members of a struct type anyways), if
the only issue is with the additional name of the member there could be
other alternatives that are simpler to understand and less error prone. For
example, and I am sure this has been proposed before, you could modify
lookup to avoid the need of the name (from the example using 'struct A' in
a previous message):
void foo();
struct A {
struct Nested { int Signed; unsigned Unsigned; } o_nested;
int x;
A() {
using o_nested {
Unsigned =3D 5;
x =3D -1;
foo();
}
}
};
Where the 'using' above would affect unqualified lookup by forcing the
lookup of the name to first check as a member of 'o_nested' (in the same
way that 'this' is checked for unqualified lookup inside a member) for
'Unsigned', if that is not found it would move up to the class scope as for
'x' or move further out according to the existing lookup rules.
I don't find Michael's example of 'tetris_t' particularly compelling, since
it seems to be throwing a bunch of unrelated functionality into a single
class and using prefixes to separate behavior. I consider that a bad design
and I'd argue that modifying the language to simplify bad designs is not
really a good goal. If anything, bad designs should be *harder*, not
*simpler* to implement.
Summarizing: If the goal is to substitute packs of local variables that are
commonly aggregated in functions, this is a horrible solution. Create a
type and have a local instance of the type. If the goal is to separate
concerns and group related *members*, then using a type and a member of the
type seem like a more reasonable solution, if the burden of typing the
member name is deemed big, a small modification to look up *in the scope of
the code that uses it* seems like a narrower and simpler change.
David
On Wed, Oct 22, 2014 at 12:52 AM, <contact@ncomputers.org> wrote:
> Jens,
>
> I've found how to give you a better example.
>
> I will only copy the declaration of the variables of my code. (Graph
> Coloring.cpp)
>
> A key property to prototyping is the fact that it is supposed to be done
>> quickly.
>
>
> I have been working on this code for more than three months. I make a
> prototype, I change it, make a new, change it again, and so on. It would
> help me a lot to have *nested namespaces*. Instead of declaring all
> variables inside each function, I would declare it inside a *nested
> namespace* (to avoid confusions if they were direct members of the
> object) and when I have a final prototype, refactor the code.
>
> (These are segments of functions (that run at different runtimes) of a
> real code with a real application):
>
> template<typename P,typename E>
> class GC{
> void function_1(){
> C*c1,*c0,**cc0,**cc1;
> P e,p,*p0,*p1;
> V*v0;
> }
>
> void function_2(){
> C*c0,*c1,*c2,**cc0,**cc1;
> H*h0,*h1,**hh0;
> P e,p,*p0,*p1;
> V*v0;
> }
>
> void function_3(){
> C*c0,*c1,*c2;
> H*h0;
> H***hhh0;
> V*v0;
> P e,*p0,*p1;
> }
>
> void function_4(){
> C*c0,*c1;
> H**hh0;
> P e,p,*p0,*p1;
> V*v0;
> }
>
> void function_5(){
> C**cc0,**cc1;
> }
>
> void function_6(){
> H*h0,*h1,*h2;
> P p,e,a;
> P*p0;
> H**hh0;
> V**vv0;
> }
>
> void function_7(){
> C**cc0,**cc1;
> H**hh0,**hh1;
> }
> };
>
> Reference: http://en.wikipedia.org/wiki/Software_prototyping
>
> El martes, 21 de octubre de 2014 13:23:14 UTC-5, Jens Maurer escribi=C3=
=B3:
>
>> On 10/21/2014 07:47 PM, con...@ncomputers.org wrote:
>> > void vertices(){
>> > P*p0,*p1;
>> > //Variables
>> > cout<<this->rn<<" vertices with edges:";
>> > for(p0=3Dthis->ra,p1=3Dthis->rz;p0<p1;)cout<<*p0++<<',';cout<<=
endl;
>>
>> > cout<<this->in<<" vertices without edges:";
>> > for(p0=3Dthis->ia,p1=3Dthis->iz;p0<p1;)cout<<*--p1<<',';cout<<=
endl;
>>
>>
>> I'd recommend investing in a space key. This is unreadable.
>>
>> Thanks,
>> Jens
>>
>> --
>
> ---
> 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.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>
--=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
--047d7bdc15d0a9da750506051cd2
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">When providing a motivating example, I would go the extra =
mile and provide how this would look in the new design.=C2=A0<br><br>Other =
than that, the comments and examples lead me to think this is really a coup=
le of conflicting things... In this last example, all of the variables are =
local to each function, while the modified design would make them members o=
f the class. This is an important change in the design, as it makes that ad=
ditional data persistent beyond the function call (additional memory requir=
ements) and prone to side effects from other functions. If one function abo=
ve calls another and it does not pass pointers or references to its local v=
ariables it is clear both to the developer (understanding of code) and the =
compiler (optimizing code) that the variable is not modified externally. On=
ce you move those local variables to the object, that is no longer the case=
.. Furthermore, it opens the door to subtle bugs where during maintenance th=
e called function starts modifying part of the temporary state and affects =
the behavior of the callee.<br><br>Regarding lookup, and on the comments ab=
ove that the use of nested types (they really need not be nested, but membe=
rs of a struct type anyways), if the only issue is with the additional name=
of the member there could be other alternatives that are simpler to unders=
tand and less error prone. For example, and I am sure this has been propose=
d before, you could modify lookup to avoid the need of the name (from the e=
xample using 'struct A' in a previous message):<br><br>void foo();<=
br>struct A {<br>=C2=A0 =C2=A0 =C2=A0struct Nested { int Signed; unsigned U=
nsigned; } o_nested;<br>=C2=A0 =C2=A0 =C2=A0int x;<br>=C2=A0 =C2=A0 =C2=A0A=
() {<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0using o_nested {<br>=C2=A0 =C2=A0=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Unsigned =3D 5;<br>=C2=A0 =C2=A0 =C2=A0=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 x =3D -1;<br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 foo();<br><div>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0}<br>=C2=
=A0 =C2=A0 =C2=A0}<br>};<br><br>Where the 'using' above would affec=
t unqualified lookup by forcing the lookup of the name to first check as a =
member of 'o_nested' (in the same way that 'this' is checke=
d for unqualified lookup inside a member) for 'Unsigned', if that i=
s not found it would move up to the class scope as for 'x' or move =
further out according to the existing lookup rules.<br><br>I don't find=
Michael's example of 'tetris_t' particularly compelling, since=
it seems to be throwing a bunch of unrelated functionality into a single c=
lass and using prefixes to separate behavior. I consider that a bad design =
and I'd argue that modifying the language to simplify bad designs is no=
t really a good goal. If anything, bad designs should be *harder*, not *sim=
pler* to implement.<br><br>Summarizing: If the goal is to substitute packs =
of local variables that are commonly aggregated in functions, this is a hor=
rible solution. Create a type and have a local instance of the type. If the=
goal is to separate concerns and group related *members*, then using a typ=
e and a member of the type seem like a more reasonable solution, if the bur=
den of typing the member name is deemed big, a small modification to look u=
p *in the scope of the code that uses it* seems like a narrower and simpler=
change.<br><br>David</div><div class=3D"gmail_extra"><br><div class=3D"gma=
il_quote">On Wed, Oct 22, 2014 at 12:52 AM, <span dir=3D"ltr"><<a href=
=3D"mailto:contact@ncomputers.org" target=3D"_blank">contact@ncomputers.org=
</a>></span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin=
:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204)=
;border-left-style:solid;padding-left:1ex"><div dir=3D"ltr">Jens,<br><br>I&=
#39;ve found how to give you a better example.<br><br>I will only copy the =
declaration of the variables of my code. (Graph Coloring.cpp)<br><br><block=
quote style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-s=
tyle:solid;border-left-color:rgb(204,204,204);padding-left:1ex" class=3D"gm=
ail_quote">A key property to prototyping is the fact that it is supposed to=
be done quickly.</blockquote><div><br>I have been working on this code for=
more than three months. I make a prototype, I change it, make a new, chang=
e it again, and so on. It would help me a lot to have <b>nested namespaces<=
/b>. Instead of declaring all variables inside each function, I would decla=
re it inside a <b>nested namespace</b> (to avoid confusions if they were di=
rect members of the object) and when I have a final prototype, refactor the=
code.<br><br>(These are segments of functions (that run at different runti=
mes) of a real code with a real application):<br><br><div style=3D"border:1=
px solid rgb(187,187,187);word-wrap:break-word;background-color:rgb(250,250=
,250)"><code><div><span style=3D"color:rgb(0,0,136)">template</span><span s=
tyle=3D"color:rgb(102,102,0)"><</span><span style=3D"color:rgb(0,0,136)"=
>typename</span><span style=3D"color:rgb(0,0,0)"> P</span><span style=3D"co=
lor:rgb(102,102,0)">,</span><span style=3D"color:rgb(0,0,136)">typename</sp=
an><span style=3D"color:rgb(0,0,0)"> E</span><span style=3D"color:rgb(102,1=
02,0)">></span><span style=3D"color:rgb(0,0,0)"><br></span><span style=
=3D"color:rgb(0,0,136)">class</span><span style=3D"color:rgb(0,0,0)"> GC</s=
pan><span style=3D"color:rgb(102,102,0)">{</span><span style=3D"color:rgb(0=
,0,0)"><br>=C2=A0 =C2=A0 </span><span style=3D"color:rgb(0,0,136)">void</sp=
an><span style=3D"color:rgb(0,0,0)"> function_1</span><span style=3D"color:=
rgb(102,102,0)">(){</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 C</span><span style=3D"color:rgb(102,102,0)">*</span><spa=
n style=3D"color:rgb(0,0,0)">c1</span><span style=3D"color:rgb(102,102,0)">=
,*</span><span style=3D"color:rgb(0,0,0)">c0</span><span style=3D"color:rgb=
(102,102,0)">,**</span><span style=3D"color:rgb(0,0,0)">cc0</span><span sty=
le=3D"color:rgb(102,102,0)">,**</span><span style=3D"color:rgb(0,0,0)">cc1<=
/span><span style=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb=
(0,0,0)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 P e</span><span style=3D"color:rgb=
(102,102,0)">,</span><span style=3D"color:rgb(0,0,0)">p</span><span style=
=3D"color:rgb(102,102,0)">,*</span><span style=3D"color:rgb(0,0,0)">p0</spa=
n><span style=3D"color:rgb(102,102,0)">,*</span><span style=3D"color:rgb(0,=
0,0)">p1</span><span style=3D"color:rgb(102,102,0)">;</span><span style=3D"=
color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 V</span><span style=3D"co=
lor:rgb(102,102,0)">*</span><span style=3D"color:rgb(0,0,0)">v0</span><span=
style=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)"><b=
r>=C2=A0 =C2=A0 </span><span style=3D"color:rgb(102,102,0)">}</span><span s=
tyle=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 <br>=C2=A0 =C2=A0 </span><span =
style=3D"color:rgb(0,0,136)">void</span><span style=3D"color:rgb(0,0,0)"> f=
unction_2</span><span style=3D"color:rgb(102,102,0)">(){</span><span style=
=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 C</span><span style=
=3D"color:rgb(102,102,0)">*</span><span style=3D"color:rgb(0,0,0)">c0</span=
><span style=3D"color:rgb(102,102,0)">,*</span><span style=3D"color:rgb(0,0=
,0)">c1</span><span style=3D"color:rgb(102,102,0)">,*</span><span style=3D"=
color:rgb(0,0,0)">c2</span><span style=3D"color:rgb(102,102,0)">,**</span><=
span style=3D"color:rgb(0,0,0)">cc0</span><span style=3D"color:rgb(102,102,=
0)">,**</span><span style=3D"color:rgb(0,0,0)">cc1</span><span style=3D"col=
or:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 H</span><span style=3D"color:rgb(102,102,0)">*</span><spa=
n style=3D"color:rgb(0,0,0)">h0</span><span style=3D"color:rgb(102,102,0)">=
,*</span><span style=3D"color:rgb(0,0,0)">h1</span><span style=3D"color:rgb=
(102,102,0)">,**</span><span style=3D"color:rgb(0,0,0)">hh0</span><span sty=
le=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)"><br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 P e</span><span style=3D"color:rgb(102,102,0)">=
,</span><span style=3D"color:rgb(0,0,0)">p</span><span style=3D"color:rgb(1=
02,102,0)">,*</span><span style=3D"color:rgb(0,0,0)">p0</span><span style=
=3D"color:rgb(102,102,0)">,*</span><span style=3D"color:rgb(0,0,0)">p1</spa=
n><span style=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0=
,0)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 V</span><span style=3D"color:rgb(102,1=
02,0)">*</span><span style=3D"color:rgb(0,0,0)">v0</span><span style=3D"col=
or:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=
=A0 </span><span style=3D"color:rgb(102,102,0)">}</span><span style=3D"colo=
r:rgb(0,0,0)"><br>=C2=A0 =C2=A0 <br>=C2=A0 =C2=A0 </span><span style=3D"col=
or:rgb(0,0,136)">void</span><span style=3D"color:rgb(0,0,0)"> function_3</s=
pan><span style=3D"color:rgb(102,102,0)">(){</span><span style=3D"color:rgb=
(0,0,0)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 C</span><span style=3D"color:rgb(1=
02,102,0)">*</span><span style=3D"color:rgb(0,0,0)">c0</span><span style=3D=
"color:rgb(102,102,0)">,*</span><span style=3D"color:rgb(0,0,0)">c1</span><=
span style=3D"color:rgb(102,102,0)">,*</span><span style=3D"color:rgb(0,0,0=
)">c2</span><span style=3D"color:rgb(102,102,0)">;</span><span style=3D"col=
or:rgb(0,0,0)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 H</span><span style=3D"color=
:rgb(102,102,0)">*</span><span style=3D"color:rgb(0,0,0)">h0</span><span st=
yle=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)"><br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 H</span><span style=3D"color:rgb(102,102,0)">**=
*</span><span style=3D"color:rgb(0,0,0)">hhh0</span><span style=3D"color:rg=
b(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 =
=C2=A0 =C2=A0 V</span><span style=3D"color:rgb(102,102,0)">*</span><span st=
yle=3D"color:rgb(0,0,0)">v0</span><span style=3D"color:rgb(102,102,0)">;</s=
pan><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 P e</s=
pan><span style=3D"color:rgb(102,102,0)">,*</span><span style=3D"color:rgb(=
0,0,0)">p0</span><span style=3D"color:rgb(102,102,0)">,*</span><span style=
=3D"color:rgb(0,0,0)">p1</span><span style=3D"color:rgb(102,102,0)">;</span=
><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 </span><span style=3D"c=
olor:rgb(102,102,0)">}</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =
=C2=A0 <br>=C2=A0 =C2=A0 </span><span style=3D"color:rgb(0,0,136)">void</sp=
an><span style=3D"color:rgb(0,0,0)"> function_4</span><span style=3D"color:=
rgb(102,102,0)">(){</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=
=A0 =C2=A0 =C2=A0 C</span><span style=3D"color:rgb(102,102,0)">*</span><spa=
n style=3D"color:rgb(0,0,0)">c0</span><span style=3D"color:rgb(102,102,0)">=
,*</span><span style=3D"color:rgb(0,0,0)">c1</span><span style=3D"color:rgb=
(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 =C2=
=A0 =C2=A0 H</span><span style=3D"color:rgb(102,102,0)">**</span><span styl=
e=3D"color:rgb(0,0,0)">hh0</span><span style=3D"color:rgb(102,102,0)">;</sp=
an><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 P e</sp=
an><span style=3D"color:rgb(102,102,0)">,</span><span style=3D"color:rgb(0,=
0,0)">p</span><span style=3D"color:rgb(102,102,0)">,*</span><span style=3D"=
color:rgb(0,0,0)">p0</span><span style=3D"color:rgb(102,102,0)">,*</span><s=
pan style=3D"color:rgb(0,0,0)">p1</span><span style=3D"color:rgb(102,102,0)=
">;</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 =
V</span><span style=3D"color:rgb(102,102,0)">*</span><span style=3D"color:r=
gb(0,0,0)">v0</span><span style=3D"color:rgb(102,102,0)">;</span><span styl=
e=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 </span><span style=3D"color:rgb(10=
2,102,0)">}</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 <br>=
=C2=A0 =C2=A0 </span><span style=3D"color:rgb(0,0,136)">void</span><span st=
yle=3D"color:rgb(0,0,0)"> function_5</span><span style=3D"color:rgb(102,102=
,0)">(){</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 =C2=A0 =
=C2=A0 C</span><span style=3D"color:rgb(102,102,0)">**</span><span style=3D=
"color:rgb(0,0,0)">cc0</span><span style=3D"color:rgb(102,102,0)">,**</span=
><span style=3D"color:rgb(0,0,0)">cc1</span><span style=3D"color:rgb(102,10=
2,0)">;</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 </span><sp=
an style=3D"color:rgb(102,102,0)">}</span><span style=3D"color:rgb(0,0,0)">=
<br>=C2=A0 =C2=A0 <br>=C2=A0 =C2=A0 </span><span style=3D"color:rgb(0,0,136=
)">void</span><span style=3D"color:rgb(0,0,0)"> function_6</span><span styl=
e=3D"color:rgb(102,102,0)">(){</span><span style=3D"color:rgb(0,0,0)"><br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 H</span><span style=3D"color:rgb(102,102,0)">*<=
/span><span style=3D"color:rgb(0,0,0)">h0</span><span style=3D"color:rgb(10=
2,102,0)">,*</span><span style=3D"color:rgb(0,0,0)">h1</span><span style=3D=
"color:rgb(102,102,0)">,*</span><span style=3D"color:rgb(0,0,0)">h2</span><=
span style=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)=
"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 P p</span><span style=3D"color:rgb(102,10=
2,0)">,</span><span style=3D"color:rgb(0,0,0)">e</span><span style=3D"color=
:rgb(102,102,0)">,</span><span style=3D"color:rgb(0,0,0)">a</span><span sty=
le=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)"><br>=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 P</span><span style=3D"color:rgb(102,102,0)">*<=
/span><span style=3D"color:rgb(0,0,0)">p0</span><span style=3D"color:rgb(10=
2,102,0)">;</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 =C2=A0=
=C2=A0 H</span><span style=3D"color:rgb(102,102,0)">**</span><span style=
=3D"color:rgb(0,0,0)">hh0</span><span style=3D"color:rgb(102,102,0)">;</spa=
n><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 V</span>=
<span style=3D"color:rgb(102,102,0)">**</span><span style=3D"color:rgb(0,0,=
0)">vv0</span><span style=3D"color:rgb(102,102,0)">;</span><span style=3D"c=
olor:rgb(0,0,0)"><br>=C2=A0 =C2=A0 </span><span style=3D"color:rgb(102,102,=
0)">}</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 <br>=C2=A0 =
=C2=A0 </span><span style=3D"color:rgb(0,0,136)">void</span><span style=3D"=
color:rgb(0,0,0)"> function_7</span><span style=3D"color:rgb(102,102,0)">()=
{</span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 C<=
/span><span style=3D"color:rgb(102,102,0)">**</span><span style=3D"color:rg=
b(0,0,0)">cc0</span><span style=3D"color:rgb(102,102,0)">,**</span><span st=
yle=3D"color:rgb(0,0,0)">cc1</span><span style=3D"color:rgb(102,102,0)">;</=
span><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 =C2=A0 =C2=A0 H</sp=
an><span style=3D"color:rgb(102,102,0)">**</span><span style=3D"color:rgb(0=
,0,0)">hh0</span><span style=3D"color:rgb(102,102,0)">,**</span><span style=
=3D"color:rgb(0,0,0)">hh1</span><span style=3D"color:rgb(102,102,0)">;</spa=
n><span style=3D"color:rgb(0,0,0)"><br>=C2=A0 =C2=A0 </span><span style=3D"=
color:rgb(102,102,0)">}</span><span style=3D"color:rgb(0,0,0)"><br></span><=
span style=3D"color:rgb(102,102,0)">};</span><span style=3D"color:rgb(0,0,0=
)"><br></span></div></code></div><br>Reference:=C2=A0<a href=3D"http://en.w=
ikipedia.org/wiki/Software_prototyping" target=3D"_blank">http://en.wikiped=
ia.org/wiki/Software_prototyping</a><br></div><span><br>El martes, 21 de oc=
tubre de 2014 13:23:14 UTC-5, Jens Maurer escribi=C3=B3:</span><div><div><b=
lockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-le=
ft-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;pad=
ding-left:1ex">On 10/21/2014 07:47 PM, <a>con...@ncomputers.org</a> wrote:
<br>> =C2=A0 =C2=A0 void vertices(){
<br>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 P*p0,*p1;
<br>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 //Variables
<br>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 cout<<this->rn<<" =
vertices with edges:";
<br>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 for(p0=3Dthis->ra,p1=3Dthis->rz;=
<u></u>p0<p1;)cout<<*p0++<<',';cout<<<u></u>en=
dl;
<br>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 cout<<this->in<<" =
vertices without edges:";
<br>> =C2=A0 =C2=A0 =C2=A0 =C2=A0 for(p0=3Dthis->ia,p1=3Dthis->iz;=
<u></u>p0<p1;)cout<<*--p1<<',';cout<<<u></u>en=
dl;
<br>
<br>I'd recommend investing in a space key.=C2=A0 This is unreadable.
<br>
<br>Thanks,
<br>Jens
<br>
<br></blockquote></div></div></div><div><div>
<p></p>
-- <br>
<br>
--- <br>
You received this message because you are subscribed to the Google Groups &=
quot;ISO C++ Standard - Future Proposals" group.<br>
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org" target=3D"_=
blank">std-proposals+unsubscribe@isocpp.org</a>.<br>
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org" target=3D"_blank">std-proposals@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank">http://groups.google.com/a/isocpp.org/gro=
up/std-proposals/</a>.<br>
</div></div></blockquote></div><br></div></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
--047d7bdc15d0a9da750506051cd2--
.
Author: contact@ncomputers.org
Date: Wed, 22 Oct 2014 09:34:01 -0700 (PDT)
Raw View
------=_Part_273_999867115.1413995641041
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
David,
Thank you very much for your answer.
When providing a motivating example, I would go the extra mile and provide=
=20
> how this would look in the new design.=20
>
Ok, this is how it would be:
Without *nested namespaces*:
template<typename P,typename E>
class GC{
void function_1(){
C*c1,*c0,**cc0,**cc1;
P e,p,*p0,*p1;
V*v0;
}
=20
void function_2(){
C*c0,*c1,*c2,**cc0,**cc1;
H*h0,*h1,**hh0;
P e,p,*p0,*p1;
V*v0;
}
=20
void function_3(){
C*c0,*c1,*c2;
H*h0;
H***hhh0;
V*v0;
P e,*p0,*p1;
}
=20
void function_4(){
C*c0,*c1;
H**hh0;
P e,p,*p0,*p1;
V*v0;
}
=20
void function_5(){
C**cc0,**cc1;
}
=20
void function_6(){
H*h0,*h1,*h2;
P p,e,a;
P*p0;
H**hh0;
V**vv0;
}
=20
void function_7(){
C**cc0,**cc1;
H**hh0,**hh1;
}
};
With *nested namespaces*:
template<typename P,typename E>
class GC{
namespace variables{
C*c0,*c1,*c2,**cc0,**cc1;
H*h0,*h1,*h2,**hh0,**hh1,***hhh0;
P e,p,a,*p0,*p1;
V*v0,**vv0;
}
void function_1(){
using namespace variables;
}
void function_2(){
using namespace variables;
}
void function_3(){
using namespace variables;
}
void function_4(){
using namespace variables;
}
void function_5(){
using namespace variables;
}
void function_6(){
using namespace variables;
}
void function_7(){
using namespace variables;
}
};
=20
El mi=C3=A9rcoles, 22 de octubre de 2014 11:05:10 UTC-5, David Rodr=C3=ADgu=
ez Ibeas=20
escribi=C3=B3:
>
> When providing a motivating example, I would go the extra mile and provid=
e=20
> how this would look in the new design.=20
>
> Other than that, the comments and examples lead me to think this is reall=
y=20
> a couple of conflicting things... In this last example, all of the=20
> variables are local to each function, while the modified design would mak=
e=20
> them members of the class. This is an important change in the design, as =
it=20
> makes that additional data persistent beyond the function call (additiona=
l=20
> memory requirements) and prone to side effects from other functions. If o=
ne=20
> function above calls another and it does not pass pointers or references =
to=20
> its local variables it is clear both to the developer (understanding of=
=20
> code) and the compiler (optimizing code) that the variable is not modifie=
d=20
> externally. Once you move those local variables to the object, that is no=
=20
> longer the case. Furthermore, it opens the door to subtle bugs where duri=
ng=20
> maintenance the called function starts modifying part of the temporary=20
> state and affects the behavior of the callee.
>
> Regarding lookup, and on the comments above that the use of nested types=
=20
> (they really need not be nested, but members of a struct type anyways), i=
f=20
> the only issue is with the additional name of the member there could be=
=20
> other alternatives that are simpler to understand and less error prone. F=
or=20
> example, and I am sure this has been proposed before, you could modify=20
> lookup to avoid the need of the name (from the example using 'struct A' i=
n=20
> a previous message):
>
> void foo();
> struct A {
> struct Nested { int Signed; unsigned Unsigned; } o_nested;
> int x;
> A() {
> using o_nested {
> Unsigned =3D 5;
> x =3D -1;
> foo();
> }
> }
> };
>
> Where the 'using' above would affect unqualified lookup by forcing the=20
> lookup of the name to first check as a member of 'o_nested' (in the same=
=20
> way that 'this' is checked for unqualified lookup inside a member) for=20
> 'Unsigned', if that is not found it would move up to the class scope as f=
or=20
> 'x' or move further out according to the existing lookup rules.
>
> I don't find Michael's example of 'tetris_t' particularly compelling,=20
> since it seems to be throwing a bunch of unrelated functionality into a=
=20
> single class and using prefixes to separate behavior. I consider that a b=
ad=20
> design and I'd argue that modifying the language to simplify bad designs =
is=20
> not really a good goal. If anything, bad designs should be *harder*, not=
=20
> *simpler* to implement.
>
> Summarizing: If the goal is to substitute packs of local variables that=
=20
> are commonly aggregated in functions, this is a horrible solution. Create=
a=20
> type and have a local instance of the type. If the goal is to separate=20
> concerns and group related *members*, then using a type and a member of t=
he=20
> type seem like a more reasonable solution, if the burden of typing the=20
> member name is deemed big, a small modification to look up *in the scope =
of=20
> the code that uses it* seems like a narrower and simpler change.
>
> David
>
> On Wed, Oct 22, 2014 at 12:52 AM, <con...@ncomputers.org <javascript:>>=
=20
> wrote:
>
>> Jens,
>>
>> I've found how to give you a better example.
>>
>> I will only copy the declaration of the variables of my code. (Graph=20
>> Coloring.cpp)
>>
>> A key property to prototyping is the fact that it is supposed to be done=
=20
>>> quickly.
>>
>>
>> I have been working on this code for more than three months. I make a=20
>> prototype, I change it, make a new, change it again, and so on. It would=
=20
>> help me a lot to have *nested namespaces*. Instead of declaring all=20
>> variables inside each function, I would declare it inside a *nested=20
>> namespace* (to avoid confusions if they were direct members of the=20
>> object) and when I have a final prototype, refactor the code.
>>
>> (These are segments of functions (that run at different runtimes) of a=
=20
>> real code with a real application):
>>
>> template<typename P,typename E>
>> class GC{
>> void function_1(){
>> C*c1,*c0,**cc0,**cc1;
>> P e,p,*p0,*p1;
>> V*v0;
>> }
>> =20
>> void function_2(){
>> C*c0,*c1,*c2,**cc0,**cc1;
>> H*h0,*h1,**hh0;
>> P e,p,*p0,*p1;
>> V*v0;
>> }
>> =20
>> void function_3(){
>> C*c0,*c1,*c2;
>> H*h0;
>> H***hhh0;
>> V*v0;
>> P e,*p0,*p1;
>> }
>> =20
>> void function_4(){
>> C*c0,*c1;
>> H**hh0;
>> P e,p,*p0,*p1;
>> V*v0;
>> }
>> =20
>> void function_5(){
>> C**cc0,**cc1;
>> }
>> =20
>> void function_6(){
>> H*h0,*h1,*h2;
>> P p,e,a;
>> P*p0;
>> H**hh0;
>> V**vv0;
>> }
>> =20
>> void function_7(){
>> C**cc0,**cc1;
>> H**hh0,**hh1;
>> }
>> };
>>
>> Reference: http://en.wikipedia.org/wiki/Software_prototyping
>>
>> El martes, 21 de octubre de 2014 13:23:14 UTC-5, Jens Maurer escribi=C3=
=B3:
>>
>>> On 10/21/2014 07:47 PM, con...@ncomputers.org wrote:=20
>>> > void vertices(){=20
>>> > P*p0,*p1;=20
>>> > //Variables=20
>>> > cout<<this->rn<<" vertices with edges:";=20
>>> > for(p0=3Dthis->ra,p1=3Dthis->rz;p0<p1;)cout<<*p0++<<',';cout<=
<endl;=20
>>>
>>> > cout<<this->in<<" vertices without edges:";=20
>>> > for(p0=3Dthis->ia,p1=3Dthis->iz;p0<p1;)cout<<*--p1<<',';cout<=
<endl;=20
>>>
>>>
>>> I'd recommend investing in a space key. This is unreadable.=20
>>>
>>> Thanks,=20
>>> Jens=20
>>>
>>> --=20
>>
>> ---=20
>> You received this message because you are subscribed to the Google Group=
s=20
>> "ISO C++ Standard - Future Proposals" group.
>> To unsubscribe from this group and stop receiving emails from it, send a=
n=20
>> email to std-proposal...@isocpp.org <javascript:>.
>> To post to this group, send email to std-pr...@isocpp.org <javascript:>.
>> Visit this group at=20
>> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>>
>
>
--=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
------=_Part_273_999867115.1413995641041
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">David,<br><br>Thank you very much for your answer.<br><br>=
<blockquote style=3D"margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(=
204, 204, 204); padding-left: 1ex;" class=3D"gmail_quote">When providing a =
motivating example, I would go the extra mile and provide how this would lo=
ok in the new design. <br></blockquote><div><br>Ok, this is how it would be=
:<br><br>Without <b>nested namespaces</b>:<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;"><co=
de class=3D"prettyprint"><div class=3D"subprettyprint"><div style=3D"backgr=
ound-color:rgb(250,250,250);border-color:rgb(187,187,187);border-style:soli=
d;border-width:1px;word-wrap:break-word"><code><div><span style=3D"color:#0=
08"><span style=3D"color: #008;" class=3D"styled-by-prettify">template</spa=
n></span><span style=3D"color:#660"><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify"><</span></span><span style=3D"color:#008"><span style=
=3D"color: #008;" class=3D"styled-by-prettify">typename</span></span><span =
style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> P</span></span><span style=3D"color:#660"><span style=3D"color: #660;"=
class=3D"styled-by-prettify">,</span></span><span style=3D"color:#008"><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">typename</span></spa=
n><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> E</span></span><span style=3D"color:#660"><span style=3D"color=
: #660;" class=3D"styled-by-prettify">></span></span><span style=3D"colo=
r:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify"><br></spa=
n></span><span style=3D"color:#008"><span style=3D"color: #008;" class=3D"s=
tyled-by-prettify">class</span></span><span style=3D"color:#000"><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> GC</span></span><span styl=
e=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;" clas=
s=3D"styled-by-prettify"><br> </span></span><span style=3D"col=
or:#008"><span style=3D"color: #008;" class=3D"styled-by-prettify">void</sp=
an></span><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> function_1</span></span><span style=3D"color:#660"><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">(){</span></span><sp=
an style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"><br> C</span></span><span style=3D"color:=
#660"><span style=3D"color: #660;" class=3D"styled-by-prettify">*</span></s=
pan><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled=
-by-prettify">c1</span></span><span style=3D"color:#660"><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">,*</span></span><span style=3D"colo=
r:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify">c0</span>=
</span><span style=3D"color:#660"><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">,**</span></span><span style=3D"color:#000"><span style=3D=
"color: #000;" class=3D"styled-by-prettify">cc0</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">cc1</span></span><span style=3D"color:#660"><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">;</span></span><span sty=
le=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify"=
><br> P e</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">p</span></span><span style=3D"color:#660"><span style=3D"color: #=
660;" class=3D"styled-by-prettify">,*</span></span><span style=3D"color:#00=
0"><span style=3D"color: #000;" class=3D"styled-by-prettify">p0</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">p1</span></span><span style=3D"color:=
#660"><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span></s=
pan><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled=
-by-prettify"><br> V</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">v0</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><span style=3D"color:#660"><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">}</span></span><span style=3D"colo=
r:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify"><br> =
; <br> </span></span><span style=3D"color:#008"><span s=
tyle=3D"color: #008;" class=3D"styled-by-prettify">void</span></span><span =
style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> function_2</span></span><span style=3D"color:#660"><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">(){</span></span><span style=3D"colo=
r:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify"><br> =
; C</span></span><span style=3D"color:#660"><span styl=
e=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">c=
0</span></span><span style=3D"color:#660"><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">,*</span></span><span style=3D"color:#000"><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify">c1</span></span><span st=
yle=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;" c=
lass=3D"styled-by-prettify">c2</span></span><span style=3D"color:#660"><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">,**</span></span><spa=
n style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-pret=
tify">cc0</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">cc1</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> H</spa=
n></span><span style=3D"color:#660"><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">*</span></span><span style=3D"color:#000"><span style=3D=
"color: #000;" class=3D"styled-by-prettify">h0</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">h1</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">h=
h0</span></span><span style=3D"color:#660"><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">;</span></span><span style=3D"color:#000"><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br> =
P e</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">p</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">p0</span></span><span style=3D"color:#6=
60"><span style=3D"color: #660;" class=3D"styled-by-prettify">,*</span></sp=
an><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-=
by-prettify">p1</span></span><span style=3D"color:#660"><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">;</span></span><span style=3D"color:=
#000"><span style=3D"color: #000;" class=3D"styled-by-prettify"><br> =
V</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">v=
0</span></span><span style=3D"color:#660"><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">;</span></span><span style=3D"color:#000"><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"><br> </span>=
</span><span style=3D"color:#660"><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">}</span></span><span style=3D"color:#000"><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"><br> <br> &nbs=
p; </span></span><span style=3D"color:#008"><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">void</span></span><span style=3D"color:#000"><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> function_3</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"c=
olor: #000;" class=3D"styled-by-prettify"><br> C=
</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">c0</span></span><span styl=
e=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;" cla=
ss=3D"styled-by-prettify">c1</span></span><span style=3D"color:#660"><span =
style=3D"color: #660;" class=3D"styled-by-prettify">,*</span></span><span s=
tyle=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-prettif=
y">c2</span></span><span style=3D"color:#660"><span style=3D"color: #660;" =
class=3D"styled-by-prettify">;</span></span><span style=3D"color:#000"><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br> &nb=
sp; H</span></span><span style=3D"color:#660"><span style=3D"color: =
#660;" class=3D"styled-by-prettify">*</span></span><span style=3D"color:#00=
0"><span style=3D"color: #000;" class=3D"styled-by-prettify">h0</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> H</spa=
n></span><span style=3D"color:#660"><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">***</span></span><span style=3D"color:#000"><span style=
=3D"color: #000;" class=3D"styled-by-prettify">hhh0</span></span><span styl=
e=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;" clas=
s=3D"styled-by-prettify"><br> V</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">v0</span></span><span style=3D"color:#660">=
<span style=3D"color: #660;" class=3D"styled-by-prettify">;</span></span><s=
pan style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"><br> P e</span></span><span style=3D"col=
or:#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">p0</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">p1</s=
pan></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></s=
pan><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"colo=
r: #000;" class=3D"styled-by-prettify"><br> <br> =
</span></span><span style=3D"color:#008"><span style=3D"color: #008;" class=
=3D"styled-by-prettify">void</span></span><span style=3D"color:#000"><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> function_4</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"colo=
r: #000;" class=3D"styled-by-prettify"><br> C</s=
pan></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">c0</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;" clas=
s=3D"styled-by-prettify">c1</span></span><span style=3D"color:#660"><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">;</span></span><span sty=
le=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify"=
><br> H</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-p=
rettify">hh0</span></span><span style=3D"color:#660"><span style=3D"color: =
#660;" class=3D"styled-by-prettify">;</span></span><span style=3D"color:#00=
0"><span style=3D"color: #000;" class=3D"styled-by-prettify"><br> &nb=
sp; P e</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">p=
</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 st=
yle=3D"color: #000;" class=3D"styled-by-prettify">p0</span></span><span sty=
le=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;" cl=
ass=3D"styled-by-prettify">p1</span></span><span style=3D"color:#660"><span=
style=3D"color: #660;" class=3D"styled-by-prettify">;</span></span><span s=
tyle=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"><br> V</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">v0</span></span><span style=3D"color:#660"><span style=3D"color: =
#660;" class=3D"styled-by-prettify">;</span></span><span style=3D"color:#00=
0"><span style=3D"color: #000;" class=3D"styled-by-prettify"><br> &nb=
sp; </span></span><span style=3D"color:#660"><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">}</span></span><span style=3D"color:#000"><span=
style=3D"color: #000;" class=3D"styled-by-prettify"><br> <br>=
</span></span><span style=3D"color:#008"><span style=3D"color=
: #008;" class=3D"styled-by-prettify">void</span></span><span style=3D"colo=
r:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify"> function=
_5</span></span><span style=3D"color:#660"><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">(){</span></span><span style=3D"color:#000"><span=
style=3D"color: #000;" class=3D"styled-by-prettify"><br> &nbs=
p; C</span></span><span style=3D"color:#660"><span style=3D"color: #=
660;" class=3D"styled-by-prettify">**</span></span><span style=3D"color:#00=
0"><span style=3D"color: #000;" class=3D"styled-by-prettify">cc0</span></sp=
an><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"col=
or: #000;" class=3D"styled-by-prettify">cc1</span></span><span style=3D"col=
or:#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"sty=
led-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-p=
rettify"><br> <br> </span></span><span style=3D"c=
olor:#008"><span style=3D"color: #008;" class=3D"styled-by-prettify">void</=
span></span><span style=3D"color:#000"><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> function_6</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> H</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">h0</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">h1</s=
pan></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">h2</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> P p</span></span><s=
pan style=3D"color:#660"><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">,</span></span><span style=3D"color:#000"><span style=3D"color: #00=
0;" class=3D"styled-by-prettify">e</span></span><span style=3D"color:#660">=
<span style=3D"color: #660;" class=3D"styled-by-prettify">,</span></span><s=
pan style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify">a</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"><br> =
P</span></span><span style=3D"color:#660"><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">*</span></span><span style=3D"color=
:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify">p0</span><=
/span><span style=3D"color:#660"><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">;</span></span><span style=3D"color:#000"><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br> H<=
/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 st=
yle=3D"color: #000;" class=3D"styled-by-prettify">hh0</span></span><span st=
yle=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;" cl=
ass=3D"styled-by-prettify"><br> V</span></span><=
span style=3D"color:#660"><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">**</span></span><span style=3D"color:#000"><span style=3D"color: #=
000;" class=3D"styled-by-prettify">vv0</span></span><span style=3D"color:#6=
60"><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span></spa=
n><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"><br> </span></span><span style=3D"color:#660"><spa=
n 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-pretti=
fy"><br> <br> </span></span><span style=3D"color:=
#008"><span style=3D"color: #008;" class=3D"styled-by-prettify">void</span>=
</span><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> function_7</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-pretti=
fy"><br> C</span></span><span style=3D"color:#66=
0"><span style=3D"color: #660;" class=3D"styled-by-prettify">**</span></spa=
n><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-b=
y-prettify">cc0</span></span><span style=3D"color:#660"><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">,**</span></span><span style=3D"colo=
r:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify">cc1</span=
></span><span style=3D"color:#660"><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">;</span></span><span style=3D"color:#000"><span style=3D"=
color: #000;" class=3D"styled-by-prettify"><br> =
H</span></span><span style=3D"color:#660"><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">**</span></span><span style=3D"color:#000"><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify">hh0</span></span><span s=
tyle=3D"color:#660"><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">,**</span></span><span style=3D"color:#000"><span style=3D"color: #000;"=
class=3D"styled-by-prettify">hh1</span></span><span style=3D"color:#660"><=
span style=3D"color: #660;" class=3D"styled-by-prettify">;</span></span><sp=
an style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"><br> </span></span><span style=3D"color:#660"><span sty=
le=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><span style=3D"color:#660"><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">};</span></span><span style=3D"color:#000"><span=
style=3D"color: #000;" class=3D"styled-by-prettify"><br></span></span></di=
v></code></div></div></code></div><br>With <b>nested namespaces</b>:<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"><span style=3D"color: #008;" class=3D"styled-by-prettify">template</s=
pan><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">typename</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> P</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color=
: #008;" class=3D"styled-by-prettify">typename</span><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> E</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">></span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br></span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">class</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> GC</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br=
> </span><span style=3D"color: #008;" class=3D"styled-by-prett=
ify">namespace</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"> variables</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&=
nbsp; C</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">*</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify">c0</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>,*</span><span style=3D"color: #000;" class=3D"styled-by-prettify">c1</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">,*</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify">c2</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">,**</span><span style=3D"color:=
#000;" class=3D"styled-by-prettify">cc0</span><span style=3D"color: #660;"=
class=3D"styled-by-prettify">,**</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">cc1</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"><br> H</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">*</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">h0</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">,*</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify">h1</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
,*</span><span style=3D"color: #000;" class=3D"styled-by-prettify">h2</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">,**</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify">hh0</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">,**</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify">hh1</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">,***</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify">hhh0</span><span style=3D"color: #660;" class=3D=
"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"><br> P e</span><span style=3D"color:=
#660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify">p</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify">a</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>,*</span><span style=3D"color: #000;" class=3D"styled-by-prettify">p0</spa=
n><span style=3D"color: #660;" class=3D"styled-by-prettify">,*</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify">p1</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"><br> V</span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify">*</span><span sty=
le=3D"color: #000;" class=3D"styled-by-prettify">v0</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">,**</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify">vv0</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"st=
yled-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><br> </span><span style=3D"color: #008;" =
class=3D"styled-by-prettify">void</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> function_1</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">(){</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br> </span><span style=3D"col=
or: #008;" class=3D"styled-by-prettify">using</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" cla=
ss=3D"styled-by-prettify">namespace</span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"> variables</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styl=
ed-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;" cl=
ass=3D"styled-by-prettify">void</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> function_2</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(){</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br> </span><span style=3D"colo=
r: #008;" class=3D"styled-by-prettify">using</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" clas=
s=3D"styled-by-prettify">namespace</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> variables</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-prettify">}</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br><br> </span><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">void</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> function_3</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(){</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br> </span><span style=3D"colo=
r: #008;" class=3D"styled-by-prettify">using</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" clas=
s=3D"styled-by-prettify">namespace</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> variables</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-prettify">}</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br><br> </span><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">void</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> function_4</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(){</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br> </span><span style=3D"colo=
r: #008;" class=3D"styled-by-prettify">using</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" clas=
s=3D"styled-by-prettify">namespace</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> variables</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-prettify">}</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br><br> </span><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">void</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> function_5</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(){</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br> </span><span style=3D"colo=
r: #008;" class=3D"styled-by-prettify">using</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" clas=
s=3D"styled-by-prettify">namespace</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> variables</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-prettify">}</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br><br> </span><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">void</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> function_6</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(){</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br> </span><span style=3D"colo=
r: #008;" class=3D"styled-by-prettify">using</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" clas=
s=3D"styled-by-prettify">namespace</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> variables</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-prettify">}</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br><br> </span><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">void</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> function_7</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(){</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"><br> </span><span style=3D"colo=
r: #008;" class=3D"styled-by-prettify">using</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" clas=
s=3D"styled-by-prettify">namespace</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> variables</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-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></span></div></code></div> <br></div>El mi=C3=A9rcoles, 22 de oct=
ubre de 2014 11:05:10 UTC-5, David Rodr=C3=ADguez Ibeas escribi=C3=B3:<bloc=
kquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-l=
eft: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">When providing a m=
otivating example, I would go the extra mile and provide how this would loo=
k in the new design. <br><br>Other than that, the comments and example=
s lead me to think this is really a couple of conflicting things... In this=
last example, all of the variables are local to each function, while the m=
odified design would make them members of the class. This is an important c=
hange in the design, as it makes that additional data persistent beyond the=
function call (additional memory requirements) and prone to side effects f=
rom other functions. If one function above calls another and it does not pa=
ss pointers or references to its local variables it is clear both to the de=
veloper (understanding of code) and the compiler (optimizing code) that the=
variable is not modified externally. Once you move those local variables t=
o the object, that is no longer the case. Furthermore, it opens the door to=
subtle bugs where during maintenance the called function starts modifying =
part of the temporary state and affects the behavior of the callee.<br><br>=
Regarding lookup, and on the comments above that the use of nested types (t=
hey really need not be nested, but members of a struct type anyways), if th=
e only issue is with the additional name of the member there could be other=
alternatives that are simpler to understand and less error prone. For exam=
ple, and I am sure this has been proposed before, you could modify lookup t=
o avoid the need of the name (from the example using 'struct A' in a previo=
us message):<br><br>void foo();<br>struct A {<br> struct=
Nested { int Signed; unsigned Unsigned; } o_nested;<br>  =
;int x;<br> A() {<br> u=
sing o_nested {<br> Unsigne=
d =3D 5;<br> x =3D -1;<br>&=
nbsp; foo();<br><div>  =
; }<br> }<br>};<br><br>Where the 'us=
ing' above would affect unqualified lookup by forcing the lookup of the nam=
e to first check as a member of 'o_nested' (in the same way that 'this' is =
checked for unqualified lookup inside a member) for 'Unsigned', if that is =
not found it would move up to the class scope as for 'x' or move further ou=
t according to the existing lookup rules.<br><br>I don't find Michael's exa=
mple of 'tetris_t' particularly compelling, since it seems to be throwing a=
bunch of unrelated functionality into a single class and using prefixes to=
separate behavior. I consider that a bad design and I'd argue that modifyi=
ng the language to simplify bad designs is not really a good goal. If anyth=
ing, bad designs should be *harder*, not *simpler* to implement.<br><br>Sum=
marizing: If the goal is to substitute packs of local variables that are co=
mmonly aggregated in functions, this is a horrible solution. Create a type =
and have a local instance of the type. If the goal is to separate concerns =
and group related *members*, then using a type and a member of the type see=
m like a more reasonable solution, if the burden of typing the member name =
is deemed big, a small modification to look up *in the scope of the code th=
at uses it* seems like a narrower and simpler change.<br><br>David</div><di=
v><br><div class=3D"gmail_quote">On Wed, Oct 22, 2014 at 12:52 AM, <span d=
ir=3D"ltr"><<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mai=
lto=3D"XBKMnadk0fQJ" onmousedown=3D"this.href=3D'javascript:';return true;"=
onclick=3D"this.href=3D'javascript:';return true;">con...@ncomputers.org</=
a>></span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0=
px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);b=
order-left-style:solid;padding-left:1ex"><div dir=3D"ltr">Jens,<br><br>I've=
found how to give you a better example.<br><br>I will only copy the declar=
ation of the variables of my code. (Graph Coloring.cpp)<br><br><blockquote =
style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:s=
olid;border-left-color:rgb(204,204,204);padding-left:1ex" class=3D"gmail_qu=
ote">A key property to prototyping is the fact that it is supposed to be do=
ne quickly.</blockquote><div><br>I have been working on this code for more =
than three months. I make a prototype, I change it, make a new, change it a=
gain, and so on. It would help me a lot to have <b>nested namespaces</b>. I=
nstead of declaring all variables inside each function, I would declare it =
inside a <b>nested namespace</b> (to avoid confusions if they were direct m=
embers of the object) and when I have a final prototype, refactor the code.=
<br><br>(These are segments of functions (that run at different runtimes) o=
f a real code with a real application):<br><br><div style=3D"border:1px sol=
id rgb(187,187,187);word-wrap:break-word;background-color:rgb(250,250,250)"=
><code><div><span style=3D"color:rgb(0,0,136)">template</span><span style=
=3D"color:rgb(102,102,0)"><</span><span style=3D"color:rgb(0,0,136)">typ=
ename</span><span style=3D"color:rgb(0,0,0)"> P</span><span style=3D"color:=
rgb(102,102,0)">,</span><span style=3D"color:rgb(0,0,136)">typename</span><=
span style=3D"color:rgb(0,0,0)"> E</span><span style=3D"color:rgb(102,102,0=
)">></span><span style=3D"color:rgb(0,0,0)"><br></span><span style=3D"co=
lor:rgb(0,0,136)">class</span><span style=3D"color:rgb(0,0,0)"> GC</span><s=
pan style=3D"color:rgb(102,102,0)">{</span><span style=3D"color:rgb(0,0,0)"=
><br> </span><span style=3D"color:rgb(0,0,136)">void</span><sp=
an style=3D"color:rgb(0,0,0)"> function_1</span><span style=3D"color:rgb(10=
2,102,0)">(){</span><span style=3D"color:rgb(0,0,0)"><br> &nbs=
p; C</span><span style=3D"color:rgb(102,102,0)">*</span><span style=
=3D"color:rgb(0,0,0)">c1</span><span style=3D"color:rgb(102,102,0)">,*</spa=
n><span style=3D"color:rgb(0,0,0)">c0</span><span style=3D"color:rgb(102,10=
2,0)">,**</span><span style=3D"color:rgb(0,0,0)">cc0</span><span style=3D"c=
olor:rgb(102,102,0)">,**</span><span style=3D"color:rgb(0,0,0)">cc1</span><=
span style=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)=
"><br> P e</span><span style=3D"color:rgb(102,10=
2,0)">,</span><span style=3D"color:rgb(0,0,0)">p</span><span style=3D"color=
:rgb(102,102,0)">,*</span><span style=3D"color:rgb(0,0,0)">p0</span><span s=
tyle=3D"color:rgb(102,102,0)">,*</span><span style=3D"color:rgb(0,0,0)">p1<=
/span><span style=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb=
(0,0,0)"><br> V</span><span style=3D"color:rgb(1=
02,102,0)">*</span><span style=3D"color:rgb(0,0,0)">v0</span><span style=3D=
"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)"><br> =
</span><span style=3D"color:rgb(102,102,0)">}</span><span style=3D"c=
olor:rgb(0,0,0)"><br> <br> </span><span style=3D"=
color:rgb(0,0,136)">void</span><span style=3D"color:rgb(0,0,0)"> function_2=
</span><span style=3D"color:rgb(102,102,0)">(){</span><span style=3D"color:=
rgb(0,0,0)"><br> C</span><span style=3D"color:rg=
b(102,102,0)">*</span><span style=3D"color:rgb(0,0,0)">c0</span><span style=
=3D"color:rgb(102,102,0)">,*</span><span style=3D"color:rgb(0,0,0)">c1</spa=
n><span style=3D"color:rgb(102,102,0)">,*</span><span style=3D"color:rgb(0,=
0,0)">c2</span><span style=3D"color:rgb(102,102,0)">,**</span><span style=
=3D"color:rgb(0,0,0)">cc0</span><span style=3D"color:rgb(102,102,0)">,**</s=
pan><span style=3D"color:rgb(0,0,0)">cc1</span><span style=3D"color:rgb(102=
,102,0)">;</span><span style=3D"color:rgb(0,0,0)"><br> =
H</span><span style=3D"color:rgb(102,102,0)">*</span><span style=3D"=
color:rgb(0,0,0)">h0</span><span style=3D"color:rgb(102,102,0)">,*</span><s=
pan style=3D"color:rgb(0,0,0)">h1</span><span style=3D"color:rgb(102,102,0)=
">,**</span><span style=3D"color:rgb(0,0,0)">hh0</span><span style=3D"color=
:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)"><br> =
P e</span><span style=3D"color:rgb(102,102,0)">,</span><span=
style=3D"color:rgb(0,0,0)">p</span><span style=3D"color:rgb(102,102,0)">,*=
</span><span style=3D"color:rgb(0,0,0)">p0</span><span style=3D"color:rgb(1=
02,102,0)">,*</span><span style=3D"color:rgb(0,0,0)">p1</span><span style=
=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)"><br>&nbs=
p; V</span><span style=3D"color:rgb(102,102,0)">*</spa=
n><span style=3D"color:rgb(0,0,0)">v0</span><span style=3D"color:rgb(102,10=
2,0)">;</span><span style=3D"color:rgb(0,0,0)"><br> </span><sp=
an style=3D"color:rgb(102,102,0)">}</span><span style=3D"color:rgb(0,0,0)">=
<br> <br> </span><span style=3D"color:rgb(0,0,136=
)">void</span><span style=3D"color:rgb(0,0,0)"> function_3</span><span styl=
e=3D"color:rgb(102,102,0)">(){</span><span style=3D"color:rgb(0,0,0)"><br>&=
nbsp; C</span><span style=3D"color:rgb(102,102,0)">*</=
span><span style=3D"color:rgb(0,0,0)">c0</span><span style=3D"color:rgb(102=
,102,0)">,*</span><span style=3D"color:rgb(0,0,0)">c1</span><span style=3D"=
color:rgb(102,102,0)">,*</span><span style=3D"color:rgb(0,0,0)">c2</span><s=
pan style=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)"=
><br> H</span><span style=3D"color:rgb(102,102,0=
)">*</span><span style=3D"color:rgb(0,0,0)">h0</span><span style=3D"color:r=
gb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)"><br> &=
nbsp; H</span><span style=3D"color:rgb(102,102,0)">***</span><span s=
tyle=3D"color:rgb(0,0,0)">hhh0</span><span style=3D"color:rgb(102,102,0)">;=
</span><span style=3D"color:rgb(0,0,0)"><br> V</=
span><span style=3D"color:rgb(102,102,0)">*</span><span style=3D"color:rgb(=
0,0,0)">v0</span><span style=3D"color:rgb(102,102,0)">;</span><span style=
=3D"color:rgb(0,0,0)"><br> P e</span><span style=
=3D"color:rgb(102,102,0)">,*</span><span style=3D"color:rgb(0,0,0)">p0</spa=
n><span style=3D"color:rgb(102,102,0)">,*</span><span style=3D"color:rgb(0,=
0,0)">p1</span><span style=3D"color:rgb(102,102,0)">;</span><span style=3D"=
color:rgb(0,0,0)"><br> </span><span style=3D"color:rgb(102,102=
,0)">}</span><span style=3D"color:rgb(0,0,0)"><br> <br> =
</span><span style=3D"color:rgb(0,0,136)">void</span><span style=3D"=
color:rgb(0,0,0)"> function_4</span><span style=3D"color:rgb(102,102,0)">()=
{</span><span style=3D"color:rgb(0,0,0)"><br> C<=
/span><span style=3D"color:rgb(102,102,0)">*</span><span style=3D"color:rgb=
(0,0,0)">c0</span><span style=3D"color:rgb(102,102,0)">,*</span><span style=
=3D"color:rgb(0,0,0)">c1</span><span style=3D"color:rgb(102,102,0)">;</span=
><span style=3D"color:rgb(0,0,0)"><br> H</span><=
span style=3D"color:rgb(102,102,0)">**</span><span style=3D"color:rgb(0,0,0=
)">hh0</span><span style=3D"color:rgb(102,102,0)">;</span><span style=3D"co=
lor:rgb(0,0,0)"><br> P e</span><span style=3D"co=
lor:rgb(102,102,0)">,</span><span style=3D"color:rgb(0,0,0)">p</span><span =
style=3D"color:rgb(102,102,0)">,*</span><span style=3D"color:rgb(0,0,0)">p0=
</span><span style=3D"color:rgb(102,102,0)">,*</span><span style=3D"color:r=
gb(0,0,0)">p1</span><span style=3D"color:rgb(102,102,0)">;</span><span styl=
e=3D"color:rgb(0,0,0)"><br> V</span><span style=
=3D"color:rgb(102,102,0)">*</span><span style=3D"color:rgb(0,0,0)">v0</span=
><span style=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0,=
0)"><br> </span><span style=3D"color:rgb(102,102,0)">}</span><=
span style=3D"color:rgb(0,0,0)"><br> <br> </span>=
<span style=3D"color:rgb(0,0,136)">void</span><span style=3D"color:rgb(0,0,=
0)"> function_5</span><span style=3D"color:rgb(102,102,0)">(){</span><span =
style=3D"color:rgb(0,0,0)"><br> C</span><span st=
yle=3D"color:rgb(102,102,0)">**</span><span style=3D"color:rgb(0,0,0)">cc0<=
/span><span style=3D"color:rgb(102,102,0)">,**</span><span style=3D"color:r=
gb(0,0,0)">cc1</span><span style=3D"color:rgb(102,102,0)">;</span><span sty=
le=3D"color:rgb(0,0,0)"><br> </span><span style=3D"color:rgb(1=
02,102,0)">}</span><span style=3D"color:rgb(0,0,0)"><br> <br>&=
nbsp; </span><span style=3D"color:rgb(0,0,136)">void</span><span sty=
le=3D"color:rgb(0,0,0)"> function_6</span><span style=3D"color:rgb(102,102,=
0)">(){</span><span style=3D"color:rgb(0,0,0)"><br> &nb=
sp; H</span><span style=3D"color:rgb(102,102,0)">*</span><span style=3D"col=
or:rgb(0,0,0)">h0</span><span style=3D"color:rgb(102,102,0)">,*</span><span=
style=3D"color:rgb(0,0,0)">h1</span><span style=3D"color:rgb(102,102,0)">,=
*</span><span style=3D"color:rgb(0,0,0)">h2</span><span style=3D"color:rgb(=
102,102,0)">;</span><span style=3D"color:rgb(0,0,0)"><br> &nbs=
p; P p</span><span style=3D"color:rgb(102,102,0)">,</span><span styl=
e=3D"color:rgb(0,0,0)">e</span><span style=3D"color:rgb(102,102,0)">,</span=
><span style=3D"color:rgb(0,0,0)">a</span><span style=3D"color:rgb(102,102,=
0)">;</span><span style=3D"color:rgb(0,0,0)"><br>  =
; P</span><span style=3D"color:rgb(102,102,0)">*</span><span style=3D"color=
:rgb(0,0,0)">p0</span><span style=3D"color:rgb(102,102,0)">;</span><span st=
yle=3D"color:rgb(0,0,0)"><br> H</span><span styl=
e=3D"color:rgb(102,102,0)">**</span><span style=3D"color:rgb(0,0,0)">hh0</s=
pan><span style=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(0=
,0,0)"><br> V</span><span style=3D"color:rgb(102=
,102,0)">**</span><span style=3D"color:rgb(0,0,0)">vv0</span><span style=3D=
"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)"><br> =
</span><span style=3D"color:rgb(102,102,0)">}</span><span style=3D"c=
olor:rgb(0,0,0)"><br> <br> </span><span style=3D"=
color:rgb(0,0,136)">void</span><span style=3D"color:rgb(0,0,0)"> function_7=
</span><span style=3D"color:rgb(102,102,0)">(){</span><span style=3D"color:=
rgb(0,0,0)"><br> C</span><span style=3D"color:rg=
b(102,102,0)">**</span><span style=3D"color:rgb(0,0,0)">cc0</span><span sty=
le=3D"color:rgb(102,102,0)">,**</span><span style=3D"color:rgb(0,0,0)">cc1<=
/span><span style=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb=
(0,0,0)"><br> H</span><span style=3D"color:rgb(1=
02,102,0)">**</span><span style=3D"color:rgb(0,0,0)">hh0</span><span style=
=3D"color:rgb(102,102,0)">,**</span><span style=3D"color:rgb(0,0,0)">hh1</s=
pan><span style=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(0=
,0,0)"><br> </span><span style=3D"color:rgb(102,102,0)">}</spa=
n><span style=3D"color:rgb(0,0,0)"><br></span><span style=3D"color:rgb(102,=
102,0)">};</span><span style=3D"color:rgb(0,0,0)"><br></span></div></code><=
/div><br>Reference: <a href=3D"http://en.wikipedia.org/wiki/Software_p=
rototyping" target=3D"_blank" onmousedown=3D"this.href=3D'http://www.google=
..com/url?q\75http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FSoftware_prototyping\46=
sa\75D\46sntz\0751\46usg\75AFQjCNF0oTeXY9CCp0DlQkC9b9DYI0jdwA';return true;=
" onclick=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fen.wik=
ipedia.org%2Fwiki%2FSoftware_prototyping\46sa\75D\46sntz\0751\46usg\75AFQjC=
NF0oTeXY9CCp0DlQkC9b9DYI0jdwA';return true;">http://en.<wbr>wikipedia.org/w=
iki/Software_<wbr>prototyping</a><br></div><span><br>El martes, 21 de octub=
re de 2014 13:23:14 UTC-5, Jens Maurer escribi=C3=B3:</span><div><div><bloc=
kquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-=
width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;paddin=
g-left:1ex">On 10/21/2014 07:47 PM, <a>con...@ncomputers.org</a> wrote:
<br>> void vertices(){
<br>> P*p0,*p1;
<br>> //Variables
<br>> cout<<this->rn<<" verti=
ces with edges:";
<br>> for(p0=3Dthis->ra,p1=3Dthis->rz;=
<u></u>p0<wbr><p1;)cout<<*p0++<<',';cout<<<u></u>en<wb=
r>dl;
<br>> cout<<this->in<<" verti=
ces without edges:";
<br>> for(p0=3Dthis->ia,p1=3Dthis->iz;=
<u></u>p0<wbr><p1;)cout<<*--p1<<',';cout<<<u></u>en<wb=
r>dl;
<br>
<br>I'd recommend investing in a space key. This is unreadable.
<br>
<br>Thanks,
<br>Jens
<br>
<br></blockquote></div></div></div><div><div>
<p></p>
-- <br>
<br>
--- <br>
You received this message because you are subscribed to the Google Groups "=
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"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"=
XBKMnadk0fQJ" onmousedown=3D"this.href=3D'javascript:';return true;" onclic=
k=3D"this.href=3D'javascript:';return true;">std-proposal...@<wbr>isocpp.or=
g</a>.<br>
To post to this group, send email to <a href=3D"javascript:" target=3D"_bla=
nk" gdf-obfuscated-mailto=3D"XBKMnadk0fQJ" onmousedown=3D"this.href=3D'java=
script:';return true;" onclick=3D"this.href=3D'javascript:';return true;">s=
td-pr...@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank" onmousedown=3D"this.href=3D'http://groups=
..google.com/a/isocpp.org/group/std-proposals/';return true;" onclick=3D"thi=
s.href=3D'http://groups.google.com/a/isocpp.org/group/std-proposals/';retur=
n true;">http://groups.google.com/a/<wbr>isocpp.org/group/std-<wbr>proposal=
s/</a>.<br>
</div></div></blockquote></div><br></div></div>
</blockquote></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_273_999867115.1413995641041--
.
Author: contact@ncomputers.org
Date: Wed, 22 Oct 2014 10:10:43 -0700 (PDT)
Raw View
------=_Part_46_1207787291.1413997843315
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
David,
=20
> all of the variables are local to each function, while the modified desig=
n=20
> would make them members of the class. This is an important change in the=
=20
> design, as it makes that additional data persistent beyond the function=
=20
> call (additional memory requirements) and prone to side effects from othe=
r=20
> functions. If one function above calls another and it does not pass=20
> pointers or references to its local variables it is clear both to the=20
> developer (understanding of code) and the compiler (optimizing code) that=
=20
> the variable is not modified externally. Once you move those local=20
> variables to the object, that is no longer the case.
>
I agree with you. I will try to express me better. To declare the local=20
variables inside each function requires time. When prototyping this happen=
=20
hundreds of times. I've written an entire function of 60 or more lines.=20
Four days later deleted it completely, and so on. When prototyping, changes=
=20
to the code happens all the time. I know that the variables would be=20
members of the class. One purpose of *nested namespaces* is to avoid making=
=20
them direct members, because sometimes I've used them accidentally when=20
they are direct members. These accidents could be avoided with the need to=
=20
access them through the namespace. Note that on this example the functions=
=20
doesn't pass any argument. The variables are only local inteded to store=20
temporary values of functions that run at different runtimes.
Furthermore, it opens the door to subtle bugs where during maintenance the=
=20
> called function starts modifying part of the temporary state and affects=
=20
> the behavior of the callee.
Prototypes are incomplete versions of the real code. When I have written=20
the final prototype, I would replace the line "using namespace variables;"=
=20
with the content of the *nested namespace*, compile the code and delete=20
each variable's declaration that the compilers says that is not used. So=20
would be the door to subtle bugs closed during maintenance. That's what I=
=20
tried to express when I wrote to Jens: "refactor the code".
If the goal is to substitute packs of local variables that are commonly=20
> aggregated in functions, this is a horrible solution.
I would rejoice if you can write me more arguments to consider it a=20
horrible solution.
If the goal is to separate concerns and group related *members*, then using=
=20
> a type and a member of the type seem like a more reasonable solution.
What you are proposing is also a good idea. I think that we should place=20
both proposals together. Sometimes would be better to declare a *nested=20
class* than to declare a *nested namespace*. The "namespace" of a nested=20
class can be created undefined times as an object, exactly how you are=20
purposing in your code.
I propose: *nested namespaces* + *use objects as namespace*
PF, ncomputers.org=20
=20
El mi=C3=A9rcoles, 22 de octubre de 2014 11:05:10 UTC-5, David Rodr=C3=ADgu=
ez Ibeas=20
escribi=C3=B3:
>
> When providing a motivating example, I would go the extra mile and provid=
e=20
> how this would look in the new design.=20
>
> Other than that, the comments and examples lead me to think this is reall=
y=20
> a couple of conflicting things... In this last example, all of the=20
> variables are local to each function, while the modified design would mak=
e=20
> them members of the class. This is an important change in the design, as =
it=20
> makes that additional data persistent beyond the function call (additiona=
l=20
> memory requirements) and prone to side effects from other functions. If o=
ne=20
> function above calls another and it does not pass pointers or references =
to=20
> its local variables it is clear both to the developer (understanding of=
=20
> code) and the compiler (optimizing code) that the variable is not modifie=
d=20
> externally. Once you move those local variables to the object, that is no=
=20
> longer the case. Furthermore, it opens the door to subtle bugs where duri=
ng=20
> maintenance the called function starts modifying part of the temporary=20
> state and affects the behavior of the callee.
>
> Regarding lookup, and on the comments above that the use of nested types=
=20
> (they really need not be nested, but members of a struct type anyways), i=
f=20
> the only issue is with the additional name of the member there could be=
=20
> other alternatives that are simpler to understand and less error prone. F=
or=20
> example, and I am sure this has been proposed before, you could modify=20
> lookup to avoid the need of the name (from the example using 'struct A' i=
n=20
> a previous message):
>
> void foo();
> struct A {
> struct Nested { int Signed; unsigned Unsigned; } o_nested;
> int x;
> A() {
> using o_nested {
> Unsigned =3D 5;
> x =3D -1;
> foo();
> }
> }
> };
>
> Where the 'using' above would affect unqualified lookup by forcing the=20
> lookup of the name to first check as a member of 'o_nested' (in the same=
=20
> way that 'this' is checked for unqualified lookup inside a member) for=20
> 'Unsigned', if that is not found it would move up to the class scope as f=
or=20
> 'x' or move further out according to the existing lookup rules.
>
> I don't find Michael's example of 'tetris_t' particularly compelling,=20
> since it seems to be throwing a bunch of unrelated functionality into a=
=20
> single class and using prefixes to separate behavior. I consider that a b=
ad=20
> design and I'd argue that modifying the language to simplify bad designs =
is=20
> not really a good goal. If anything, bad designs should be *harder*, not=
=20
> *simpler* to implement.
>
> Summarizing: If the goal is to substitute packs of local variables that=
=20
> are commonly aggregated in functions, this is a horrible solution. Create=
a=20
> type and have a local instance of the type. If the goal is to separate=20
> concerns and group related *members*, then using a type and a member of t=
he=20
> type seem like a more reasonable solution, if the burden of typing the=20
> member name is deemed big, a small modification to look up *in the scope =
of=20
> the code that uses it* seems like a narrower and simpler change.
>
> David
>
> On Wed, Oct 22, 2014 at 12:52 AM, <con...@ncomputers.org <javascript:>>=
=20
> wrote:
>
>> Jens,
>>
>> I've found how to give you a better example.
>>
>> I will only copy the declaration of the variables of my code. (Graph=20
>> Coloring.cpp)
>>
>> A key property to prototyping is the fact that it is supposed to be done=
=20
>>> quickly.
>>
>>
>> I have been working on this code for more than three months. I make a=20
>> prototype, I change it, make a new, change it again, and so on. It would=
=20
>> help me a lot to have *nested namespaces*. Instead of declaring all=20
>> variables inside each function, I would declare it inside a *nested=20
>> namespace* (to avoid confusions if they were direct members of the=20
>> object) and when I have a final prototype, refactor the code.
>>
>> (These are segments of functions (that run at different runtimes) of a=
=20
>> real code with a real application):
>>
>> template<typename P,typename E>
>> class GC{
>> void function_1(){
>> C*c1,*c0,**cc0,**cc1;
>> P e,p,*p0,*p1;
>> V*v0;
>> }
>> =20
>> void function_2(){
>> C*c0,*c1,*c2,**cc0,**cc1;
>> H*h0,*h1,**hh0;
>> P e,p,*p0,*p1;
>> V*v0;
>> }
>> =20
>> void function_3(){
>> C*c0,*c1,*c2;
>> H*h0;
>> H***hhh0;
>> V*v0;
>> P e,*p0,*p1;
>> }
>> =20
>> void function_4(){
>> C*c0,*c1;
>> H**hh0;
>> P e,p,*p0,*p1;
>> V*v0;
>> }
>> =20
>> void function_5(){
>> C**cc0,**cc1;
>> }
>> =20
>> void function_6(){
>> H*h0,*h1,*h2;
>> P p,e,a;
>> P*p0;
>> H**hh0;
>> V**vv0;
>> }
>> =20
>> void function_7(){
>> C**cc0,**cc1;
>> H**hh0,**hh1;
>> }
>> };
>>
>> Reference: http://en.wikipedia.org/wiki/Software_prototyping
>>
>> El martes, 21 de octubre de 2014 13:23:14 UTC-5, Jens Maurer escribi=C3=
=B3:
>>
>>> On 10/21/2014 07:47 PM, con...@ncomputers.org wrote:=20
>>> > void vertices(){=20
>>> > P*p0,*p1;=20
>>> > //Variables=20
>>> > cout<<this->rn<<" vertices with edges:";=20
>>> > for(p0=3Dthis->ra,p1=3Dthis->rz;p0<p1;)cout<<*p0++<<',';cout<=
<endl;=20
>>>
>>> > cout<<this->in<<" vertices without edges:";=20
>>> > for(p0=3Dthis->ia,p1=3Dthis->iz;p0<p1;)cout<<*--p1<<',';cout<=
<endl;=20
>>>
>>>
>>> I'd recommend investing in a space key. This is unreadable.=20
>>>
>>> Thanks,=20
>>> Jens=20
>>>
>>> --=20
>>
>> ---=20
>> You received this message because you are subscribed to the Google Group=
s=20
>> "ISO C++ Standard - Future Proposals" group.
>> To unsubscribe from this group and stop receiving emails from it, send a=
n=20
>> email to std-proposal...@isocpp.org <javascript:>.
>> To post to this group, send email to std-pr...@isocpp.org <javascript:>.
>> Visit this group at=20
>> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>>
>
>
--=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
------=_Part_46_1207787291.1413997843315
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div>David,<br> </div><blockquote style=3D"margin: 0p=
x 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1=
ex;" class=3D"gmail_quote">all of the variables are local to each function,=
while the modified=20
design would make them members of the class. This is an important change
in the design, as it makes that additional data persistent beyond the=20
function call (additional memory requirements) and prone to side effects
from other functions. If one function above calls another and it does=20
not pass pointers or references to its local variables it is clear both=20
to the developer (understanding of code) and the compiler (optimizing=20
code) that the variable is not modified externally. Once you move those=20
local variables to the object, that is no longer the case.<br></blockquote>=
<div><br>I agree with you. I will try to express me better. To declare the =
local variables inside each function requires time. When prototyping this h=
appen hundreds of times. I've written an entire function of 60 or more line=
s. Four days later deleted it completely, and so on. When prototyping, chan=
ges to the code happens all the time. I know that the variables would be me=
mbers of the class. One purpose of <b>nested namespaces</b> is to avoid mak=
ing them direct members, because sometimes I've used them accidentally when=
they are direct members. These accidents could be avoided with the need to=
access them through the namespace. Note that on this example the functions=
doesn't pass any argument. The variables are only local inteded to store t=
emporary values of functions that run at different runtimes.<br><br><blockq=
uote style=3D"margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 20=
4, 204); padding-left: 1ex;" class=3D"gmail_quote"> Furthermore,=20
it opens the door to subtle bugs where during maintenance the called=20
function starts modifying part of the temporary state and affects the=20
behavior of the callee.</blockquote><div><br>Prototypes are incomplete vers=
ions of the real code. When I have written the final prototype, I would rep=
lace the line "<span style=3D"font-family: courier new,monospace;">using na=
mespace variables;</span>" with the content of the <b>nested namespace</b>,=
compile the code and delete each variable's declaration that the compilers=
says that is not used. So would be the door to subtle bugs closed during m=
aintenance. That's what I tried to express when I wrote to Jens: "refactor =
the code".<br><br><blockquote style=3D"margin: 0px 0px 0px 0.8ex; border-le=
ft: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class=3D"gmail_quote"=
>If the goal is to substitute packs of local variables that are commonly ag=
gregated in functions, this is a horrible solution.</blockquote><div><br>I =
would rejoice if you can write me more arguments to consider it a horrible =
solution.<br><br><blockquote style=3D"margin: 0px 0px 0px 0.8ex; border-lef=
t: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class=3D"gmail_quote">=
If the goal is to separate concerns and group related *members*, then=20
using a type and a member of the type seem like a more reasonable=20
solution.</blockquote><div><br>What you are proposing is also a good idea. =
I think that we should place both proposals together. Sometimes would be be=
tter to declare a <b>nested class</b> than to declare a <b>nested namespace=
</b>. The "namespace" of a nested class can be created undefined times as a=
n object, exactly how you are purposing in your code.<br><br>I propose: <b>=
nested namespaces</b> + <b>use objects as namespace</b><br><br>PF, ncompute=
rs.org <br></div></div></div> </div>El mi=C3=A9rcoles, 22 de octubre d=
e 2014 11:05:10 UTC-5, David Rodr=C3=ADguez Ibeas escribi=C3=B3:<blockquote=
class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1=
px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr">When providing a motivat=
ing example, I would go the extra mile and provide how this would look in t=
he new design. <br><br>Other than that, the comments and examples lead=
me to think this is really a couple of conflicting things... In this last =
example, all of the variables are local to each function, while the modifie=
d design would make them members of the class. This is an important change =
in the design, as it makes that additional data persistent beyond the funct=
ion call (additional memory requirements) and prone to side effects from ot=
her functions. If one function above calls another and it does not pass poi=
nters or references to its local variables it is clear both to the develope=
r (understanding of code) and the compiler (optimizing code) that the varia=
ble is not modified externally. Once you move those local variables to the =
object, that is no longer the case. Furthermore, it opens the door to subtl=
e bugs where during maintenance the called function starts modifying part o=
f the temporary state and affects the behavior of the callee.<br><br>Regard=
ing lookup, and on the comments above that the use of nested types (they re=
ally need not be nested, but members of a struct type anyways), if the only=
issue is with the additional name of the member there could be other alter=
natives that are simpler to understand and less error prone. For example, a=
nd I am sure this has been proposed before, you could modify lookup to avoi=
d the need of the name (from the example using 'struct A' in a previous mes=
sage):<br><br>void foo();<br>struct A {<br> struct Neste=
d { int Signed; unsigned Unsigned; } o_nested;<br> int x=
;<br> A() {<br> using o=
_nested {<br> Unsigned =3D =
5;<br> x =3D -1;<br> =
foo();<br><div> &nbs=
p; }<br> }<br>};<br><br>Where the 'using' a=
bove would affect unqualified lookup by forcing the lookup of the name to f=
irst check as a member of 'o_nested' (in the same way that 'this' is checke=
d for unqualified lookup inside a member) for 'Unsigned', if that is not fo=
und it would move up to the class scope as for 'x' or move further out acco=
rding to the existing lookup rules.<br><br>I don't find Michael's example o=
f 'tetris_t' particularly compelling, since it seems to be throwing a bunch=
of unrelated functionality into a single class and using prefixes to separ=
ate behavior. I consider that a bad design and I'd argue that modifying the=
language to simplify bad designs is not really a good goal. If anything, b=
ad designs should be *harder*, not *simpler* to implement.<br><br>Summarizi=
ng: If the goal is to substitute packs of local variables that are commonly=
aggregated in functions, this is a horrible solution. Create a type and ha=
ve a local instance of the type. If the goal is to separate concerns and gr=
oup related *members*, then using a type and a member of the type seem like=
a more reasonable solution, if the burden of typing the member name is dee=
med big, a small modification to look up *in the scope of the code that use=
s it* seems like a narrower and simpler change.<br><br>David</div><div><br>=
<div class=3D"gmail_quote">On Wed, Oct 22, 2014 at 12:52 AM, <span dir=3D"=
ltr"><<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D=
"XBKMnadk0fQJ" onmousedown=3D"this.href=3D'javascript:';return true;" oncli=
ck=3D"this.href=3D'javascript:';return true;">con...@ncomputers.org</a>>=
</span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px=
0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-=
left-style:solid;padding-left:1ex"><div dir=3D"ltr">Jens,<br><br>I've found=
how to give you a better example.<br><br>I will only copy the declaration =
of the variables of my code. (Graph Coloring.cpp)<br><br><blockquote style=
=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-style:solid;=
border-left-color:rgb(204,204,204);padding-left:1ex" class=3D"gmail_quote">=
A key property to prototyping is the fact that it is supposed to be done qu=
ickly.</blockquote><div><br>I have been working on this code for more than =
three months. I make a prototype, I change it, make a new, change it again,=
and so on. It would help me a lot to have <b>nested namespaces</b>. Instea=
d of declaring all variables inside each function, I would declare it insid=
e a <b>nested namespace</b> (to avoid confusions if they were direct member=
s of the object) and when I have a final prototype, refactor the code.<br><=
br>(These are segments of functions (that run at different runtimes) of a r=
eal code with a real application):<br><br><div style=3D"border:1px solid rg=
b(187,187,187);word-wrap:break-word;background-color:rgb(250,250,250)"><cod=
e><div><span style=3D"color:rgb(0,0,136)">template</span><span style=3D"col=
or:rgb(102,102,0)"><</span><span style=3D"color:rgb(0,0,136)">typename</=
span><span style=3D"color:rgb(0,0,0)"> P</span><span style=3D"color:rgb(102=
,102,0)">,</span><span style=3D"color:rgb(0,0,136)">typename</span><span st=
yle=3D"color:rgb(0,0,0)"> E</span><span style=3D"color:rgb(102,102,0)">>=
</span><span style=3D"color:rgb(0,0,0)"><br></span><span style=3D"color:rgb=
(0,0,136)">class</span><span style=3D"color:rgb(0,0,0)"> GC</span><span sty=
le=3D"color:rgb(102,102,0)">{</span><span style=3D"color:rgb(0,0,0)"><br>&n=
bsp; </span><span style=3D"color:rgb(0,0,136)">void</span><span styl=
e=3D"color:rgb(0,0,0)"> function_1</span><span style=3D"color:rgb(102,102,0=
)">(){</span><span style=3D"color:rgb(0,0,0)"><br> &nbs=
p; C</span><span style=3D"color:rgb(102,102,0)">*</span><span style=3D"colo=
r:rgb(0,0,0)">c1</span><span style=3D"color:rgb(102,102,0)">,*</span><span =
style=3D"color:rgb(0,0,0)">c0</span><span style=3D"color:rgb(102,102,0)">,*=
*</span><span style=3D"color:rgb(0,0,0)">cc0</span><span style=3D"color:rgb=
(102,102,0)">,**</span><span style=3D"color:rgb(0,0,0)">cc1</span><span sty=
le=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)"><br>&n=
bsp; P e</span><span style=3D"color:rgb(102,102,0)">,<=
/span><span style=3D"color:rgb(0,0,0)">p</span><span style=3D"color:rgb(102=
,102,0)">,*</span><span style=3D"color:rgb(0,0,0)">p0</span><span style=3D"=
color:rgb(102,102,0)">,*</span><span style=3D"color:rgb(0,0,0)">p1</span><s=
pan style=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)"=
><br> V</span><span style=3D"color:rgb(102,102,0=
)">*</span><span style=3D"color:rgb(0,0,0)">v0</span><span style=3D"color:r=
gb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)"><br> <=
/span><span style=3D"color:rgb(102,102,0)">}</span><span style=3D"color:rgb=
(0,0,0)"><br> <br> </span><span style=3D"color:rg=
b(0,0,136)">void</span><span style=3D"color:rgb(0,0,0)"> function_2</span><=
span style=3D"color:rgb(102,102,0)">(){</span><span style=3D"color:rgb(0,0,=
0)"><br> C</span><span style=3D"color:rgb(102,10=
2,0)">*</span><span style=3D"color:rgb(0,0,0)">c0</span><span style=3D"colo=
r:rgb(102,102,0)">,*</span><span style=3D"color:rgb(0,0,0)">c1</span><span =
style=3D"color:rgb(102,102,0)">,*</span><span style=3D"color:rgb(0,0,0)">c2=
</span><span style=3D"color:rgb(102,102,0)">,**</span><span style=3D"color:=
rgb(0,0,0)">cc0</span><span style=3D"color:rgb(102,102,0)">,**</span><span =
style=3D"color:rgb(0,0,0)">cc1</span><span style=3D"color:rgb(102,102,0)">;=
</span><span style=3D"color:rgb(0,0,0)"><br> H</=
span><span style=3D"color:rgb(102,102,0)">*</span><span style=3D"color:rgb(=
0,0,0)">h0</span><span style=3D"color:rgb(102,102,0)">,*</span><span style=
=3D"color:rgb(0,0,0)">h1</span><span style=3D"color:rgb(102,102,0)">,**</sp=
an><span style=3D"color:rgb(0,0,0)">hh0</span><span style=3D"color:rgb(102,=
102,0)">;</span><span style=3D"color:rgb(0,0,0)"><br> &=
nbsp; P e</span><span style=3D"color:rgb(102,102,0)">,</span><span style=3D=
"color:rgb(0,0,0)">p</span><span style=3D"color:rgb(102,102,0)">,*</span><s=
pan style=3D"color:rgb(0,0,0)">p0</span><span style=3D"color:rgb(102,102,0)=
">,*</span><span style=3D"color:rgb(0,0,0)">p1</span><span style=3D"color:r=
gb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)"><br> &=
nbsp; V</span><span style=3D"color:rgb(102,102,0)">*</span><span sty=
le=3D"color:rgb(0,0,0)">v0</span><span style=3D"color:rgb(102,102,0)">;</sp=
an><span style=3D"color:rgb(0,0,0)"><br> </span><span style=3D=
"color:rgb(102,102,0)">}</span><span style=3D"color:rgb(0,0,0)"><br> =
<br> </span><span style=3D"color:rgb(0,0,136)">void</sp=
an><span style=3D"color:rgb(0,0,0)"> function_3</span><span style=3D"color:=
rgb(102,102,0)">(){</span><span style=3D"color:rgb(0,0,0)"><br>  =
; C</span><span style=3D"color:rgb(102,102,0)">*</span><span =
style=3D"color:rgb(0,0,0)">c0</span><span style=3D"color:rgb(102,102,0)">,*=
</span><span style=3D"color:rgb(0,0,0)">c1</span><span style=3D"color:rgb(1=
02,102,0)">,*</span><span style=3D"color:rgb(0,0,0)">c2</span><span style=
=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)"><br>&nbs=
p; H</span><span style=3D"color:rgb(102,102,0)">*</spa=
n><span style=3D"color:rgb(0,0,0)">h0</span><span style=3D"color:rgb(102,10=
2,0)">;</span><span style=3D"color:rgb(0,0,0)"><br> &nb=
sp; H</span><span style=3D"color:rgb(102,102,0)">***</span><span style=3D"c=
olor:rgb(0,0,0)">hhh0</span><span style=3D"color:rgb(102,102,0)">;</span><s=
pan style=3D"color:rgb(0,0,0)"><br> V</span><spa=
n style=3D"color:rgb(102,102,0)">*</span><span style=3D"color:rgb(0,0,0)">v=
0</span><span style=3D"color:rgb(102,102,0)">;</span><span style=3D"color:r=
gb(0,0,0)"><br> P e</span><span style=3D"color:r=
gb(102,102,0)">,*</span><span style=3D"color:rgb(0,0,0)">p0</span><span sty=
le=3D"color:rgb(102,102,0)">,*</span><span style=3D"color:rgb(0,0,0)">p1</s=
pan><span style=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(0=
,0,0)"><br> </span><span style=3D"color:rgb(102,102,0)">}</spa=
n><span style=3D"color:rgb(0,0,0)"><br> <br> </sp=
an><span style=3D"color:rgb(0,0,136)">void</span><span style=3D"color:rgb(0=
,0,0)"> function_4</span><span style=3D"color:rgb(102,102,0)">(){</span><sp=
an style=3D"color:rgb(0,0,0)"><br> C</span><span=
style=3D"color:rgb(102,102,0)">*</span><span style=3D"color:rgb(0,0,0)">c0=
</span><span style=3D"color:rgb(102,102,0)">,*</span><span style=3D"color:r=
gb(0,0,0)">c1</span><span style=3D"color:rgb(102,102,0)">;</span><span styl=
e=3D"color:rgb(0,0,0)"><br> H</span><span style=
=3D"color:rgb(102,102,0)">**</span><span style=3D"color:rgb(0,0,0)">hh0</sp=
an><span style=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,=
0,0)"><br> P e</span><span style=3D"color:rgb(10=
2,102,0)">,</span><span style=3D"color:rgb(0,0,0)">p</span><span style=3D"c=
olor:rgb(102,102,0)">,*</span><span style=3D"color:rgb(0,0,0)">p0</span><sp=
an style=3D"color:rgb(102,102,0)">,*</span><span style=3D"color:rgb(0,0,0)"=
>p1</span><span style=3D"color:rgb(102,102,0)">;</span><span style=3D"color=
:rgb(0,0,0)"><br> V</span><span style=3D"color:r=
gb(102,102,0)">*</span><span style=3D"color:rgb(0,0,0)">v0</span><span styl=
e=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)"><br>&nb=
sp; </span><span style=3D"color:rgb(102,102,0)">}</span><span style=
=3D"color:rgb(0,0,0)"><br> <br> </span><span styl=
e=3D"color:rgb(0,0,136)">void</span><span style=3D"color:rgb(0,0,0)"> funct=
ion_5</span><span style=3D"color:rgb(102,102,0)">(){</span><span style=3D"c=
olor:rgb(0,0,0)"><br> C</span><span style=3D"col=
or:rgb(102,102,0)">**</span><span style=3D"color:rgb(0,0,0)">cc0</span><spa=
n style=3D"color:rgb(102,102,0)">,**</span><span style=3D"color:rgb(0,0,0)"=
>cc1</span><span style=3D"color:rgb(102,102,0)">;</span><span style=3D"colo=
r:rgb(0,0,0)"><br> </span><span style=3D"color:rgb(102,102,0)"=
>}</span><span style=3D"color:rgb(0,0,0)"><br> <br> &nbs=
p; </span><span style=3D"color:rgb(0,0,136)">void</span><span style=3D"colo=
r:rgb(0,0,0)"> function_6</span><span style=3D"color:rgb(102,102,0)">(){</s=
pan><span style=3D"color:rgb(0,0,0)"><br> H</spa=
n><span style=3D"color:rgb(102,102,0)">*</span><span style=3D"color:rgb(0,0=
,0)">h0</span><span style=3D"color:rgb(102,102,0)">,*</span><span style=3D"=
color:rgb(0,0,0)">h1</span><span style=3D"color:rgb(102,102,0)">,*</span><s=
pan style=3D"color:rgb(0,0,0)">h2</span><span style=3D"color:rgb(102,102,0)=
">;</span><span style=3D"color:rgb(0,0,0)"><br> =
P p</span><span style=3D"color:rgb(102,102,0)">,</span><span style=3D"color=
:rgb(0,0,0)">e</span><span style=3D"color:rgb(102,102,0)">,</span><span sty=
le=3D"color:rgb(0,0,0)">a</span><span style=3D"color:rgb(102,102,0)">;</spa=
n><span style=3D"color:rgb(0,0,0)"><br> P</span>=
<span style=3D"color:rgb(102,102,0)">*</span><span style=3D"color:rgb(0,0,0=
)">p0</span><span style=3D"color:rgb(102,102,0)">;</span><span style=3D"col=
or:rgb(0,0,0)"><br> H</span><span style=3D"color=
:rgb(102,102,0)">**</span><span style=3D"color:rgb(0,0,0)">hh0</span><span =
style=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)"><br=
> V</span><span style=3D"color:rgb(102,102,0)">*=
*</span><span style=3D"color:rgb(0,0,0)">vv0</span><span style=3D"color:rgb=
(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)"><br> </s=
pan><span style=3D"color:rgb(102,102,0)">}</span><span style=3D"color:rgb(0=
,0,0)"><br> <br> </span><span style=3D"color:rgb(=
0,0,136)">void</span><span style=3D"color:rgb(0,0,0)"> function_7</span><sp=
an style=3D"color:rgb(102,102,0)">(){</span><span style=3D"color:rgb(0,0,0)=
"><br> C</span><span style=3D"color:rgb(102,102,=
0)">**</span><span style=3D"color:rgb(0,0,0)">cc0</span><span style=3D"colo=
r:rgb(102,102,0)">,**</span><span style=3D"color:rgb(0,0,0)">cc1</span><spa=
n style=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)"><=
br> H</span><span style=3D"color:rgb(102,102,0)"=
>**</span><span style=3D"color:rgb(0,0,0)">hh0</span><span style=3D"color:r=
gb(102,102,0)">,**</span><span style=3D"color:rgb(0,0,0)">hh1</span><span s=
tyle=3D"color:rgb(102,102,0)">;</span><span style=3D"color:rgb(0,0,0)"><br>=
</span><span style=3D"color:rgb(102,102,0)">}</span><span sty=
le=3D"color:rgb(0,0,0)"><br></span><span style=3D"color:rgb(102,102,0)">};<=
/span><span style=3D"color:rgb(0,0,0)"><br></span></div></code></div><br>Re=
ference: <a href=3D"http://en.wikipedia.org/wiki/Software_prototyping"=
target=3D"_blank" onmousedown=3D"this.href=3D'http://www.google.com/url?q\=
75http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FSoftware_prototyping\46sa\75D\46sn=
tz\0751\46usg\75AFQjCNF0oTeXY9CCp0DlQkC9b9DYI0jdwA';return true;" onclick=
=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fen.wikipedia.or=
g%2Fwiki%2FSoftware_prototyping\46sa\75D\46sntz\0751\46usg\75AFQjCNF0oTeXY9=
CCp0DlQkC9b9DYI0jdwA';return true;">http://en.<wbr>wikipedia.org/wiki/Softw=
are_<wbr>prototyping</a><br></div><span><br>El martes, 21 de octubre de 201=
4 13:23:14 UTC-5, Jens Maurer escribi=C3=B3:</span><div><div><blockquote cl=
ass=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left-width:1px=
;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1e=
x">On 10/21/2014 07:47 PM, <a>con...@ncomputers.org</a> wrote:
<br>> void vertices(){
<br>> P*p0,*p1;
<br>> //Variables
<br>> cout<<this->rn<<" verti=
ces with edges:";
<br>> for(p0=3Dthis->ra,p1=3Dthis->rz;=
<u></u>p0<wbr><p1;)cout<<*p0++<<',';cout<<<u></u>en<wb=
r>dl;
<br>> cout<<this->in<<" verti=
ces without edges:";
<br>> for(p0=3Dthis->ia,p1=3Dthis->iz;=
<u></u>p0<wbr><p1;)cout<<*--p1<<',';cout<<<u></u>en<wb=
r>dl;
<br>
<br>I'd recommend investing in a space key. This is unreadable.
<br>
<br>Thanks,
<br>Jens
<br>
<br></blockquote></div></div></div><div><div>
<p></p>
-- <br>
<br>
--- <br>
You received this message because you are subscribed to the Google Groups "=
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"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"=
XBKMnadk0fQJ" onmousedown=3D"this.href=3D'javascript:';return true;" onclic=
k=3D"this.href=3D'javascript:';return true;">std-proposal...@<wbr>isocpp.or=
g</a>.<br>
To post to this group, send email to <a href=3D"javascript:" target=3D"_bla=
nk" gdf-obfuscated-mailto=3D"XBKMnadk0fQJ" onmousedown=3D"this.href=3D'java=
script:';return true;" onclick=3D"this.href=3D'javascript:';return true;">s=
td-pr...@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank" onmousedown=3D"this.href=3D'http://groups=
..google.com/a/isocpp.org/group/std-proposals/';return true;" onclick=3D"thi=
s.href=3D'http://groups.google.com/a/isocpp.org/group/std-proposals/';retur=
n true;">http://groups.google.com/a/<wbr>isocpp.org/group/std-<wbr>proposal=
s/</a>.<br>
</div></div></blockquote></div><br></div></div>
</blockquote></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_46_1207787291.1413997843315--
.
Author: "dgutson ." <danielgutson@gmail.com>
Date: Wed, 22 Oct 2014 14:28:29 -0300
Raw View
On Wed, Oct 22, 2014 at 1:34 PM, <contact@ncomputers.org> wrote:
> David,
>
> Thank you very much for your answer.
>
>> When providing a motivating example, I would go the extra mile and provi=
de
>> how this would look in the new design.
>
>
> Ok, this is how it would be:
>
> Without nested namespaces:
>
>
> template<typename P,typename E>
> class GC{
> void function_1(){
> C*c1,*c0,**cc0,**cc1;
> P e,p,*p0,*p1;
> V*v0;
> }
This is a symptom of bad design: too many local variables, moreover
repeated in a subset of methods.
It's an indication that a delegation or helper class may be needed.
I don't see any need for a language extension, but a good design practice.
Please explain why the helper class idiom or the delegator pattern
don't solve the problem I assume you are trying to solve.
>
> void function_2(){
> C*c0,*c1,*c2,**cc0,**cc1;
> H*h0,*h1,**hh0;
> P e,p,*p0,*p1;
> V*v0;
> }
>
> void function_3(){
> C*c0,*c1,*c2;
> H*h0;
> H***hhh0;
> V*v0;
> P e,*p0,*p1;
> }
>
> void function_4(){
> C*c0,*c1;
> H**hh0;
> P e,p,*p0,*p1;
> V*v0;
> }
>
> void function_5(){
> C**cc0,**cc1;
> }
>
> void function_6(){
> H*h0,*h1,*h2;
> P p,e,a;
> P*p0;
> H**hh0;
> V**vv0;
> }
>
> void function_7(){
> C**cc0,**cc1;
> H**hh0,**hh1;
> }
> };
>
> With nested namespaces:
>
> template<typename P,typename E>
> class GC{
> namespace variables{
> C*c0,*c1,*c2,**cc0,**cc1;
> H*h0,*h1,*h2,**hh0,**hh1,***hhh0;
> P e,p,a,*p0,*p1;
> V*v0,**vv0;
> }
>
> void function_1(){
> using namespace variables;
> }
>
> void function_2(){
> using namespace variables;
> }
>
> void function_3(){
> using namespace variables;
> }
>
> void function_4(){
> using namespace variables;
> }
>
> void function_5(){
> using namespace variables;
> }
>
> void function_6(){
> using namespace variables;
> }
>
> void function_7(){
> using namespace variables;
> }
> };
>
> El mi=C3=A9rcoles, 22 de octubre de 2014 11:05:10 UTC-5, David Rodr=C3=AD=
guez Ibeas
> escribi=C3=B3:
>>
>> When providing a motivating example, I would go the extra mile and provi=
de
>> how this would look in the new design.
>>
>> Other than that, the comments and examples lead me to think this is real=
ly
>> a couple of conflicting things... In this last example, all of the varia=
bles
>> are local to each function, while the modified design would make them
>> members of the class. This is an important change in the design, as it m=
akes
>> that additional data persistent beyond the function call (additional mem=
ory
>> requirements) and prone to side effects from other functions. If one
>> function above calls another and it does not pass pointers or references=
to
>> its local variables it is clear both to the developer (understanding of
>> code) and the compiler (optimizing code) that the variable is not modifi=
ed
>> externally. Once you move those local variables to the object, that is n=
o
>> longer the case. Furthermore, it opens the door to subtle bugs where dur=
ing
>> maintenance the called function starts modifying part of the temporary s=
tate
>> and affects the behavior of the callee.
>>
>> Regarding lookup, and on the comments above that the use of nested types
>> (they really need not be nested, but members of a struct type anyways), =
if
>> the only issue is with the additional name of the member there could be
>> other alternatives that are simpler to understand and less error prone. =
For
>> example, and I am sure this has been proposed before, you could modify
>> lookup to avoid the need of the name (from the example using 'struct A' =
in a
>> previous message):
>>
>> void foo();
>> struct A {
>> struct Nested { int Signed; unsigned Unsigned; } o_nested;
>> int x;
>> A() {
>> using o_nested {
>> Unsigned =3D 5;
>> x =3D -1;
>> foo();
>> }
>> }
>> };
>>
>> Where the 'using' above would affect unqualified lookup by forcing the
>> lookup of the name to first check as a member of 'o_nested' (in the same=
way
>> that 'this' is checked for unqualified lookup inside a member) for
>> 'Unsigned', if that is not found it would move up to the class scope as =
for
>> 'x' or move further out according to the existing lookup rules.
>>
>> I don't find Michael's example of 'tetris_t' particularly compelling,
>> since it seems to be throwing a bunch of unrelated functionality into a
>> single class and using prefixes to separate behavior. I consider that a =
bad
>> design and I'd argue that modifying the language to simplify bad designs=
is
>> not really a good goal. If anything, bad designs should be *harder*, not
>> *simpler* to implement.
>>
>> Summarizing: If the goal is to substitute packs of local variables that
>> are commonly aggregated in functions, this is a horrible solution. Creat=
e a
>> type and have a local instance of the type. If the goal is to separate
>> concerns and group related *members*, then using a type and a member of =
the
>> type seem like a more reasonable solution, if the burden of typing the
>> member name is deemed big, a small modification to look up *in the scope=
of
>> the code that uses it* seems like a narrower and simpler change.
>>
>> David
>>
>> On Wed, Oct 22, 2014 at 12:52 AM, <con...@ncomputers.org> wrote:
>>>
>>> Jens,
>>>
>>> I've found how to give you a better example.
>>>
>>> I will only copy the declaration of the variables of my code. (Graph
>>> Coloring.cpp)
>>>
>>>> A key property to prototyping is the fact that it is supposed to be do=
ne
>>>> quickly.
>>>
>>>
>>> I have been working on this code for more than three months. I make a
>>> prototype, I change it, make a new, change it again, and so on. It woul=
d
>>> help me a lot to have nested namespaces. Instead of declaring all varia=
bles
>>> inside each function, I would declare it inside a nested namespace (to =
avoid
>>> confusions if they were direct members of the object) and when I have a
>>> final prototype, refactor the code.
>>>
>>> (These are segments of functions (that run at different runtimes) of a
>>> real code with a real application):
>>>
>>> template<typename P,typename E>
>>> class GC{
>>> void function_1(){
>>> C*c1,*c0,**cc0,**cc1;
>>> P e,p,*p0,*p1;
>>> V*v0;
>>> }
>>>
>>> void function_2(){
>>> C*c0,*c1,*c2,**cc0,**cc1;
>>> H*h0,*h1,**hh0;
>>> P e,p,*p0,*p1;
>>> V*v0;
>>> }
>>>
>>> void function_3(){
>>> C*c0,*c1,*c2;
>>> H*h0;
>>> H***hhh0;
>>> V*v0;
>>> P e,*p0,*p1;
>>> }
>>>
>>> void function_4(){
>>> C*c0,*c1;
>>> H**hh0;
>>> P e,p,*p0,*p1;
>>> V*v0;
>>> }
>>>
>>> void function_5(){
>>> C**cc0,**cc1;
>>> }
>>>
>>> void function_6(){
>>> H*h0,*h1,*h2;
>>> P p,e,a;
>>> P*p0;
>>> H**hh0;
>>> V**vv0;
>>> }
>>>
>>> void function_7(){
>>> C**cc0,**cc1;
>>> H**hh0,**hh1;
>>> }
>>> };
>>>
>>> Reference: http://en.wikipedia.org/wiki/Software_prototyping
>>>
>>> El martes, 21 de octubre de 2014 13:23:14 UTC-5, Jens Maurer escribi=C3=
=B3:
>>>>
>>>> On 10/21/2014 07:47 PM, con...@ncomputers.org wrote:
>>>> > void vertices(){
>>>> > P*p0,*p1;
>>>> > //Variables
>>>> > cout<<this->rn<<" vertices with edges:";
>>>> >
>>>> > for(p0=3Dthis->ra,p1=3Dthis->rz;p0<p1;)cout<<*p0++<<',';cout<<endl;
>>>> > cout<<this->in<<" vertices without edges:";
>>>> >
>>>> > for(p0=3Dthis->ia,p1=3Dthis->iz;p0<p1;)cout<<*--p1<<',';cout<<endl;
>>>>
>>>> I'd recommend investing in a space key. This is unreadable.
>>>>
>>>> Thanks,
>>>> Jens
>>>>
>>> --
>>>
>>> ---
>>> You received this message because you are subscribed to the Google Grou=
ps
>>> "ISO C++ Standard - Future Proposals" group.
>>> To unsubscribe from this group and stop receiving emails from it, send =
an
>>> email to std-proposal...@isocpp.org.
>>> To post to this group, send email to std-pr...@isocpp.org.
>>> Visit this group at
>>> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>>
>>
> --
>
> ---
> 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.
> Visit this group at
> http://groups.google.com/a/isocpp.org/group/std-proposals/.
--=20
Who=E2=80=99s got the sweetest disposition?
One guess, that=E2=80=99s who?
Who=E2=80=99d never, ever start an argument?
Who never shows a bit of temperament?
Who's never wrong but always right?
Who'd never dream of starting a fight?
Who get stuck with all the bad luck?
--=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
.
Author: contact@ncomputers.org
Date: Wed, 22 Oct 2014 10:55:42 -0700 (PDT)
Raw View
------=_Part_665_1315348422.1414000542806
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Thank you very much for your time and your answer!
This is a symptom of bad design: too many local variables, moreover=20
> repeated in a subset of methods.=20
The local variables are required.
To avoid the repetition, *nested namespaces* would be useful.
This is a symptom of bad design: too many local variables, moreover=20
> repeated in a subset of methods.=20
> It's an indication that a delegation or helper class may be needed.=20
> I don't see any need for a language extension, but a good design practice=
..=20
> Please explain why the helper class idiom or the delegator pattern=20
> don't solve the problem I assume you are trying to solve. =20
>
I can understand, that because I haven't published the code yet, you can=20
suppose that its design is bad. I invite you to be patient. I invite to=20
wait me a few weeks.
El mi=C3=A9rcoles, 22 de octubre de 2014 12:28:30 UTC-5, dgutson escribi=C3=
=B3:
>
> On Wed, Oct 22, 2014 at 1:34 PM, <con...@ncomputers.org <javascript:>>=
=20
> wrote:=20
> > David,=20
> >=20
> > Thank you very much for your answer.=20
> >=20
> >> When providing a motivating example, I would go the extra mile and=20
> provide=20
> >> how this would look in the new design.=20
> >=20
> >=20
> > Ok, this is how it would be:=20
> >=20
> > Without nested namespaces:=20
> >=20
> >=20
> > template<typename P,typename E>=20
> > class GC{=20
> > void function_1(){=20
> > C*c1,*c0,**cc0,**cc1;=20
> > P e,p,*p0,*p1;=20
> > V*v0;=20
> > }=20
>
> This is a symptom of bad design: too many local variables, moreover=20
> repeated in a subset of methods.=20
> It's an indication that a delegation or helper class may be needed.=20
> I don't see any need for a language extension, but a good design practice=
..=20
> Please explain why the helper class idiom or the delegator pattern=20
> don't solve the problem I assume you are trying to solve.=20
>
> >=20
> > void function_2(){=20
> > C*c0,*c1,*c2,**cc0,**cc1;=20
> > H*h0,*h1,**hh0;=20
> > P e,p,*p0,*p1;=20
> > V*v0;=20
> > }=20
> >=20
> > void function_3(){=20
> > C*c0,*c1,*c2;=20
> > H*h0;=20
> > H***hhh0;=20
> > V*v0;=20
> > P e,*p0,*p1;=20
> > }=20
> >=20
> > void function_4(){=20
> > C*c0,*c1;=20
> > H**hh0;=20
> > P e,p,*p0,*p1;=20
> > V*v0;=20
> > }=20
> >=20
> > void function_5(){=20
> > C**cc0,**cc1;=20
> > }=20
> >=20
> > void function_6(){=20
> > H*h0,*h1,*h2;=20
> > P p,e,a;=20
> > P*p0;=20
> > H**hh0;=20
> > V**vv0;=20
> > }=20
> >=20
> > void function_7(){=20
> > C**cc0,**cc1;=20
> > H**hh0,**hh1;=20
> > }=20
> > };=20
> >=20
> > With nested namespaces:=20
> >=20
> > template<typename P,typename E>=20
> > class GC{=20
> > namespace variables{=20
> > C*c0,*c1,*c2,**cc0,**cc1;=20
> > H*h0,*h1,*h2,**hh0,**hh1,***hhh0;=20
> > P e,p,a,*p0,*p1;=20
> > V*v0,**vv0;=20
> > }=20
> >=20
> > void function_1(){=20
> > using namespace variables;=20
> > }=20
> >=20
> > void function_2(){=20
> > using namespace variables;=20
> > }=20
> >=20
> > void function_3(){=20
> > using namespace variables;=20
> > }=20
> >=20
> > void function_4(){=20
> > using namespace variables;=20
> > }=20
> >=20
> > void function_5(){=20
> > using namespace variables;=20
> > }=20
> >=20
> > void function_6(){=20
> > using namespace variables;=20
> > }=20
> >=20
> > void function_7(){=20
> > using namespace variables;=20
> > }=20
> > };=20
> >=20
> > El mi=C3=A9rcoles, 22 de octubre de 2014 11:05:10 UTC-5, David Rodr=C3=
=ADguez=20
> Ibeas=20
> > escribi=C3=B3:=20
> >>=20
> >> When providing a motivating example, I would go the extra mile and=20
> provide=20
> >> how this would look in the new design.=20
> >>=20
> >> Other than that, the comments and examples lead me to think this is=20
> really=20
> >> a couple of conflicting things... In this last example, all of the=20
> variables=20
> >> are local to each function, while the modified design would make them=
=20
> >> members of the class. This is an important change in the design, as it=
=20
> makes=20
> >> that additional data persistent beyond the function call (additional=
=20
> memory=20
> >> requirements) and prone to side effects from other functions. If one=
=20
> >> function above calls another and it does not pass pointers or=20
> references to=20
> >> its local variables it is clear both to the developer (understanding o=
f=20
> >> code) and the compiler (optimizing code) that the variable is not=20
> modified=20
> >> externally. Once you move those local variables to the object, that is=
=20
> no=20
> >> longer the case. Furthermore, it opens the door to subtle bugs where=
=20
> during=20
> >> maintenance the called function starts modifying part of the temporary=
=20
> state=20
> >> and affects the behavior of the callee.=20
> >>=20
> >> Regarding lookup, and on the comments above that the use of nested=20
> types=20
> >> (they really need not be nested, but members of a struct type anyways)=
,=20
> if=20
> >> the only issue is with the additional name of the member there could b=
e=20
> >> other alternatives that are simpler to understand and less error prone=
..=20
> For=20
> >> example, and I am sure this has been proposed before, you could modify=
=20
> >> lookup to avoid the need of the name (from the example using 'struct A=
'=20
> in a=20
> >> previous message):=20
> >>=20
> >> void foo();=20
> >> struct A {=20
> >> struct Nested { int Signed; unsigned Unsigned; } o_nested;=20
> >> int x;=20
> >> A() {=20
> >> using o_nested {=20
> >> Unsigned =3D 5;=20
> >> x =3D -1;=20
> >> foo();=20
> >> }=20
> >> }=20
> >> };=20
> >>=20
> >> Where the 'using' above would affect unqualified lookup by forcing the=
=20
> >> lookup of the name to first check as a member of 'o_nested' (in the=20
> same way=20
> >> that 'this' is checked for unqualified lookup inside a member) for=20
> >> 'Unsigned', if that is not found it would move up to the class scope a=
s=20
> for=20
> >> 'x' or move further out according to the existing lookup rules.=20
> >>=20
> >> I don't find Michael's example of 'tetris_t' particularly compelling,=
=20
> >> since it seems to be throwing a bunch of unrelated functionality into =
a=20
> >> single class and using prefixes to separate behavior. I consider that =
a=20
> bad=20
> >> design and I'd argue that modifying the language to simplify bad=20
> designs is=20
> >> not really a good goal. If anything, bad designs should be *harder*,=
=20
> not=20
> >> *simpler* to implement.=20
> >>=20
> >> Summarizing: If the goal is to substitute packs of local variables tha=
t=20
> >> are commonly aggregated in functions, this is a horrible solution.=20
> Create a=20
> >> type and have a local instance of the type. If the goal is to separate=
=20
> >> concerns and group related *members*, then using a type and a member o=
f=20
> the=20
> >> type seem like a more reasonable solution, if the burden of typing the=
=20
> >> member name is deemed big, a small modification to look up *in the=20
> scope of=20
> >> the code that uses it* seems like a narrower and simpler change.=20
> >>=20
> >> David=20
> >>=20
> >> On Wed, Oct 22, 2014 at 12:52 AM, <con...@ncomputers.org> wrote:=20
> >>>=20
> >>> Jens,=20
> >>>=20
> >>> I've found how to give you a better example.=20
> >>>=20
> >>> I will only copy the declaration of the variables of my code. (Graph=
=20
> >>> Coloring.cpp)=20
> >>>=20
> >>>> A key property to prototyping is the fact that it is supposed to be=
=20
> done=20
> >>>> quickly.=20
> >>>=20
> >>>=20
> >>> I have been working on this code for more than three months. I make a=
=20
> >>> prototype, I change it, make a new, change it again, and so on. It=20
> would=20
> >>> help me a lot to have nested namespaces. Instead of declaring all=20
> variables=20
> >>> inside each function, I would declare it inside a nested namespace (t=
o=20
> avoid=20
> >>> confusions if they were direct members of the object) and when I have=
=20
> a=20
> >>> final prototype, refactor the code.=20
> >>>=20
> >>> (These are segments of functions (that run at different runtimes) of =
a=20
> >>> real code with a real application):=20
> >>>=20
> >>> template<typename P,typename E>=20
> >>> class GC{=20
> >>> void function_1(){=20
> >>> C*c1,*c0,**cc0,**cc1;=20
> >>> P e,p,*p0,*p1;=20
> >>> V*v0;=20
> >>> }=20
> >>>=20
> >>> void function_2(){=20
> >>> C*c0,*c1,*c2,**cc0,**cc1;=20
> >>> H*h0,*h1,**hh0;=20
> >>> P e,p,*p0,*p1;=20
> >>> V*v0;=20
> >>> }=20
> >>>=20
> >>> void function_3(){=20
> >>> C*c0,*c1,*c2;=20
> >>> H*h0;=20
> >>> H***hhh0;=20
> >>> V*v0;=20
> >>> P e,*p0,*p1;=20
> >>> }=20
> >>>=20
> >>> void function_4(){=20
> >>> C*c0,*c1;=20
> >>> H**hh0;=20
> >>> P e,p,*p0,*p1;=20
> >>> V*v0;=20
> >>> }=20
> >>>=20
> >>> void function_5(){=20
> >>> C**cc0,**cc1;=20
> >>> }=20
> >>>=20
> >>> void function_6(){=20
> >>> H*h0,*h1,*h2;=20
> >>> P p,e,a;=20
> >>> P*p0;=20
> >>> H**hh0;=20
> >>> V**vv0;=20
> >>> }=20
> >>>=20
> >>> void function_7(){=20
> >>> C**cc0,**cc1;=20
> >>> H**hh0,**hh1;=20
> >>> }=20
> >>> };=20
> >>>=20
> >>> Reference: http://en.wikipedia.org/wiki/Software_prototyping=20
> >>>=20
> >>> El martes, 21 de octubre de 2014 13:23:14 UTC-5, Jens Maurer escribi=
=C3=B3:=20
> >>>>=20
> >>>> On 10/21/2014 07:47 PM, con...@ncomputers.org wrote:=20
> >>>> > void vertices(){=20
> >>>> > P*p0,*p1;=20
> >>>> > //Variables=20
> >>>> > cout<<this->rn<<" vertices with edges:";=20
> >>>> >=20
> >>>> > for(p0=3Dthis->ra,p1=3Dthis->rz;p0<p1;)cout<<*p0++<<',';cout<<endl=
;=20
> >>>> > cout<<this->in<<" vertices without edges:";=20
> >>>> >=20
> >>>> > for(p0=3Dthis->ia,p1=3Dthis->iz;p0<p1;)cout<<*--p1<<',';cout<<endl=
;=20
> >>>>=20
> >>>> I'd recommend investing in a space key. This is unreadable.=20
> >>>>=20
> >>>> Thanks,=20
> >>>> Jens=20
> >>>>=20
> >>> --=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, sen=
d=20
> an=20
> >>> email to std-proposal...@isocpp.org.=20
> >>> To post to this group, send email to std-pr...@isocpp.org.=20
> >>> Visit this group at=20
> >>> http://groups.google.com/a/isocpp.org/group/std-proposals/.=20
> >>=20
> >>=20
> > --=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
>
> > Visit this group at=20
> > http://groups.google.com/a/isocpp.org/group/std-proposals/.=20
>
>
>
> --=20
> Who=E2=80=99s got the sweetest disposition?=20
> One guess, that=E2=80=99s who?=20
> Who=E2=80=99d never, ever start an argument?=20
> Who never shows a bit of temperament?=20
> Who's never wrong but always right?=20
> Who'd never dream of starting a fight?=20
> Who get stuck with all the bad luck?=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
------=_Part_665_1315348422.1414000542806
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Thank you very much for your time and your answer!<br><br>=
<blockquote style=3D"margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(=
204, 204, 204); padding-left: 1ex;" class=3D"gmail_quote">This is a symptom=
of bad design: too many local variables, moreover
<br>repeated in a subset of methods.
</blockquote><div><br>The local variables are required.<br><br>To avoid the=
repetition, <b>nested namespaces</b> would be useful.<br><br><blockquote s=
tyle=3D"margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204=
); padding-left: 1ex;" class=3D"gmail_quote">This is a symptom of bad desig=
n: too many local variables, moreover
<br>repeated in a subset of methods.
<br>It's an indication that a delegation or helper class may be needed.
<br>I don't see any need for a language extension, but a good design practi=
ce.
<br>Please explain why the helper class idiom or the delegator pattern
<br>don't solve the problem I assume you are trying to solve.
<br></blockquote><div><br>I can understand, that because I haven't pu=
blished the code yet, you can suppose that its design is bad. I invite you =
to be patient. I invite to wait me a few weeks.<br></div></div><br>El mi=C3=
=A9rcoles, 22 de octubre de 2014 12:28:30 UTC-5, dgutson escribi=C3=B3:<blo=
ckquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-=
left: 1px #ccc solid;padding-left: 1ex;">On Wed, Oct 22, 2014 at 1:34 PM, &=
nbsp;<<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D=
"3s8A0Wr_880J" onmousedown=3D"this.href=3D'javascript:';return true;" oncli=
ck=3D"this.href=3D'javascript:';return true;">con...@ncomputers.org</a>>=
wrote:
<br>> David,
<br>>
<br>> Thank you very much for your answer.
<br>>
<br>>> When providing a motivating example, I would go the extra mile=
and provide
<br>>> how this would look in the new design.
<br>>
<br>>
<br>> Ok, this is how it would be:
<br>>
<br>> Without nested namespaces:
<br>>
<br>>
<br>> template<typename P,typename E>
<br>> class GC{
<br>> void function_1(){
<br>> C*c1,*c0,**cc0,**cc1;
<br>> P e,p,*p0,*p1;
<br>> V*v0;
<br>> }
<br>
<br>This is a symptom of bad design: too many local variables, moreover
<br>repeated in a subset of methods.
<br>It's an indication that a delegation or helper class may be needed.
<br>I don't see any need for a language extension, but a good design practi=
ce.
<br>Please explain why the helper class idiom or the delegator pattern
<br>don't solve the problem I assume you are trying to solve.
<br>
<br>>
<br>> void function_2(){
<br>> C*c0,*c1,*c2,**cc0,**cc1;
<br>> H*h0,*h1,**hh0;
<br>> P e,p,*p0,*p1;
<br>> V*v0;
<br>> }
<br>>
<br>> void function_3(){
<br>> C*c0,*c1,*c2;
<br>> H*h0;
<br>> H***hhh0;
<br>> V*v0;
<br>> P e,*p0,*p1;
<br>> }
<br>>
<br>> void function_4(){
<br>> C*c0,*c1;
<br>> H**hh0;
<br>> P e,p,*p0,*p1;
<br>> V*v0;
<br>> }
<br>>
<br>> void function_5(){
<br>> C**cc0,**cc1;
<br>> }
<br>>
<br>> void function_6(){
<br>> H*h0,*h1,*h2;
<br>> P p,e,a;
<br>> P*p0;
<br>> H**hh0;
<br>> V**vv0;
<br>> }
<br>>
<br>> void function_7(){
<br>> C**cc0,**cc1;
<br>> H**hh0,**hh1;
<br>> }
<br>> };
<br>>
<br>> With nested namespaces:
<br>>
<br>> template<typename P,typename E>
<br>> class GC{
<br>> namespace variables{
<br>> C*c0,*c1,*c2,**cc0,**cc1;
<br>> H*h0,*h1,*h2,**hh0,**hh1,***<wbr>hhh0;
<br>> P e,p,a,*p0,*p1;
<br>> V*v0,**vv0;
<br>> }
<br>>
<br>> void function_1(){
<br>> using namespace variables;
<br>> }
<br>>
<br>> void function_2(){
<br>> using namespace variables;
<br>> }
<br>>
<br>> void function_3(){
<br>> using namespace variables;
<br>> }
<br>>
<br>> void function_4(){
<br>> using namespace variables;
<br>> }
<br>>
<br>> void function_5(){
<br>> using namespace variables;
<br>> }
<br>>
<br>> void function_6(){
<br>> using namespace variables;
<br>> }
<br>>
<br>> void function_7(){
<br>> using namespace variables;
<br>> }
<br>> };
<br>>
<br>> El mi=C3=A9rcoles, 22 de octubre de 2014 11:05:10 UTC-5, David Rod=
r=C3=ADguez Ibeas
<br>> escribi=C3=B3:
<br>>>
<br>>> When providing a motivating example, I would go the extra mile=
and provide
<br>>> how this would look in the new design.
<br>>>
<br>>> Other than that, the comments and examples lead me to think th=
is is really
<br>>> a couple of conflicting things... In this last example, all of=
the variables
<br>>> are local to each function, while the modified design would ma=
ke them
<br>>> members of the class. This is an important change in the desig=
n, as it makes
<br>>> that additional data persistent beyond the function call (addi=
tional memory
<br>>> requirements) and prone to side effects from other functions. =
If one
<br>>> function above calls another and it does not pass pointers or =
references to
<br>>> its local variables it is clear both to the developer (underst=
anding of
<br>>> code) and the compiler (optimizing code) that the variable is =
not modified
<br>>> externally. Once you move those local variables to the object,=
that is no
<br>>> longer the case. Furthermore, it opens the door to subtle bugs=
where during
<br>>> maintenance the called function starts modifying part of the t=
emporary state
<br>>> and affects the behavior of the callee.
<br>>>
<br>>> Regarding lookup, and on the comments above that the use of ne=
sted types
<br>>> (they really need not be nested, but members of a struct type =
anyways), if
<br>>> the only issue is with the additional name of the member there=
could be
<br>>> other alternatives that are simpler to understand and less err=
or prone. For
<br>>> example, and I am sure this has been proposed before, you coul=
d modify
<br>>> lookup to avoid the need of the name (from the example using '=
struct A' in a
<br>>> previous message):
<br>>>
<br>>> void foo();
<br>>> struct A {
<br>>> struct Nested { int Signed; unsigned Unsig=
ned; } o_nested;
<br>>> int x;
<br>>> A() {
<br>>> using o_nested {
<br>>> Unsigned =3D =
5;
<br>>> x =3D -1;
<br>>> foo();
<br>>> }
<br>>> }
<br>>> };
<br>>>
<br>>> Where the 'using' above would affect unqualified lookup by for=
cing the
<br>>> lookup of the name to first check as a member of 'o_nested' (i=
n the same way
<br>>> that 'this' is checked for unqualified lookup inside a member)=
for
<br>>> 'Unsigned', if that is not found it would move up to the class=
scope as for
<br>>> 'x' or move further out according to the existing lookup rules=
..
<br>>>
<br>>> I don't find Michael's example of 'tetris_t' particularly comp=
elling,
<br>>> since it seems to be throwing a bunch of unrelated functionali=
ty into a
<br>>> single class and using prefixes to separate behavior. I consid=
er that a bad
<br>>> design and I'd argue that modifying the language to simplify b=
ad designs is
<br>>> not really a good goal. If anything, bad designs should be *ha=
rder*, not
<br>>> *simpler* to implement.
<br>>>
<br>>> Summarizing: If the goal is to substitute packs of local varia=
bles that
<br>>> are commonly aggregated in functions, this is a horrible solut=
ion. Create a
<br>>> type and have a local instance of the type. If the goal is to =
separate
<br>>> concerns and group related *members*, then using a type and a =
member of the
<br>>> type seem like a more reasonable solution, if the burden of ty=
ping the
<br>>> member name is deemed big, a small modification to look up *in=
the scope of
<br>>> the code that uses it* seems like a narrower and simpler chang=
e.
<br>>>
<br>>> David
<br>>>
<br>>> On Wed, Oct 22, 2014 at 12:52 AM, <<a>con...@ncomputers.org=
</a>> wrote:
<br>>>>
<br>>>> Jens,
<br>>>>
<br>>>> I've found how to give you a better example.
<br>>>>
<br>>>> I will only copy the declaration of the variables of my co=
de. (Graph
<br>>>> Coloring.cpp)
<br>>>>
<br>>>>> A key property to prototyping is the fact that it is s=
upposed to be done
<br>>>>> quickly.
<br>>>>
<br>>>>
<br>>>> I have been working on this code for more than three month=
s. I make a
<br>>>> prototype, I change it, make a new, change it again, and s=
o on. It would
<br>>>> help me a lot to have nested namespaces. Instead of declar=
ing all variables
<br>>>> inside each function, I would declare it inside a nested n=
amespace (to avoid
<br>>>> confusions if they were direct members of the object) and =
when I have a
<br>>>> final prototype, refactor the code.
<br>>>>
<br>>>> (These are segments of functions (that run at different ru=
ntimes) of a
<br>>>> real code with a real application):
<br>>>>
<br>>>> template<typename P,typename E>
<br>>>> class GC{
<br>>>> void function_1(){
<br>>>> C*c1,*c0,**cc0,**cc1;
<br>>>> P e,p,*p0,*p1;
<br>>>> V*v0;
<br>>>> }
<br>>>>
<br>>>> void function_2(){
<br>>>> C*c0,*c1,*c2,**cc0,**cc1;
<br>>>> H*h0,*h1,**hh0;
<br>>>> P e,p,*p0,*p1;
<br>>>> V*v0;
<br>>>> }
<br>>>>
<br>>>> void function_3(){
<br>>>> C*c0,*c1,*c2;
<br>>>> H*h0;
<br>>>> H***hhh0;
<br>>>> V*v0;
<br>>>> P e,*p0,*p1;
<br>>>> }
<br>>>>
<br>>>> void function_4(){
<br>>>> C*c0,*c1;
<br>>>> H**hh0;
<br>>>> P e,p,*p0,*p1;
<br>>>> V*v0;
<br>>>> }
<br>>>>
<br>>>> void function_5(){
<br>>>> C**cc0,**cc1;
<br>>>> }
<br>>>>
<br>>>> void function_6(){
<br>>>> H*h0,*h1,*h2;
<br>>>> P p,e,a;
<br>>>> P*p0;
<br>>>> H**hh0;
<br>>>> V**vv0;
<br>>>> }
<br>>>>
<br>>>> void function_7(){
<br>>>> C**cc0,**cc1;
<br>>>> H**hh0,**hh1;
<br>>>> }
<br>>>> };
<br>>>>
<br>>>> Reference: <a href=3D"http://en.wikipedia.org/wiki/Softwar=
e_prototyping" target=3D"_blank" onmousedown=3D"this.href=3D'http://www.goo=
gle.com/url?q\75http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FSoftware_prototyping=
\46sa\75D\46sntz\0751\46usg\75AFQjCNF0oTeXY9CCp0DlQkC9b9DYI0jdwA';return tr=
ue;" onclick=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fen.=
wikipedia.org%2Fwiki%2FSoftware_prototyping\46sa\75D\46sntz\0751\46usg\75AF=
QjCNF0oTeXY9CCp0DlQkC9b9DYI0jdwA';return true;">http://en.wikipedia.org/wik=
i/<wbr>Software_prototyping</a>
<br>>>>
<br>>>> El martes, 21 de octubre de 2014 13:23:14 UTC-5, Jens Maur=
er escribi=C3=B3:
<br>>>>>
<br>>>>> On 10/21/2014 07:47 PM, <a>con...@ncomputers.org</a> w=
rote:
<br>>>>> > void vertices(){
<br>>>>> > P*p0,*p1;
<br>>>>> > //Variables
<br>>>>> > cout<<this->=
rn<<" vertices with edges:";
<br>>>>> >
<br>>>>> > for(p0=3Dthis->ra,p1=3Dthis->rz;<wbr>p0<=
p1;)cout<<*p0++<<',';cout<<<wbr>endl;
<br>>>>> > cout<<this->=
in<<" vertices without edges:";
<br>>>>> >
<br>>>>> > for(p0=3Dthis->ia,p1=3Dthis->iz;<wbr>p0<=
p1;)cout<<*--p1<<',';cout<<<wbr>endl;
<br>>>>>
<br>>>>> I'd recommend investing in a space key. This is =
unreadable.
<br>>>>>
<br>>>>> Thanks,
<br>>>>> Jens
<br>>>>>
<br>>>> --
<br>>>>
<br>>>> ---
<br>>>> You received this message because you are subscribed to th=
e Google Groups
<br>>>> "ISO C++ Standard - Future Proposals" group.
<br>>>> To unsubscribe from this group and stop receiving emails f=
rom it, send an
<br>>>> email to <a>std-proposal...@isocpp.org</a>.
<br>>>> To post to this group, send email to <a>std-pr...@isocpp.o=
rg</a>.
<br>>>> Visit this group at
<br>>>> <a href=3D"http://groups.google.com/a/isocpp.org/group/std=
-proposals/" target=3D"_blank" onmousedown=3D"this.href=3D'http://groups.go=
ogle.com/a/isocpp.org/group/std-proposals/';return true;" onclick=3D"this.h=
ref=3D'http://groups.google.com/a/isocpp.org/group/std-proposals/';return t=
rue;">http://groups.google.com/a/<wbr>isocpp.org/group/std-<wbr>proposals/<=
/a>.
<br>>>
<br>>>
<br>> --
<br>>
<br>> ---
<br>> You received this message because you are subscribed to the Google=
Groups
<br>> "ISO C++ Standard - Future Proposals" group.
<br>> To unsubscribe from this group and stop receiving emails from it, =
send an
<br>> email to <a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-=
mailto=3D"3s8A0Wr_880J" onmousedown=3D"this.href=3D'javascript:';return tru=
e;" onclick=3D"this.href=3D'javascript:';return true;">std-proposal...@<wbr=
>isocpp.org</a>.
<br>> To post to this group, send email to <a href=3D"javascript:" targe=
t=3D"_blank" gdf-obfuscated-mailto=3D"3s8A0Wr_880J" onmousedown=3D"this.hre=
f=3D'javascript:';return true;" onclick=3D"this.href=3D'javascript:';return=
true;">std-pr...@isocpp.org</a>.
<br>> Visit this group at
<br>> <a href=3D"http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/" target=3D"_blank" onmousedown=3D"this.href=3D'http://groups.google.com=
/a/isocpp.org/group/std-proposals/';return true;" onclick=3D"this.href=3D'h=
ttp://groups.google.com/a/isocpp.org/group/std-proposals/';return true;">ht=
tp://groups.google.com/a/<wbr>isocpp.org/group/std-<wbr>proposals/</a>.
<br>
<br>
<br>
<br>--=20
<br>Who=E2=80=99s got the sweetest disposition?
<br>One guess, that=E2=80=99s who?
<br>Who=E2=80=99d never, ever start an argument?
<br>Who never shows a bit of temperament?
<br>Who's never wrong but always right?
<br>Who'd never dream of starting a fight?
<br>Who get stuck with all the bad luck?
<br></blockquote></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_665_1315348422.1414000542806--
.
Author: Nevin Liber <nevin@eviloverlord.com>
Date: Wed, 22 Oct 2014 13:13:36 -0500
Raw View
--f46d0438903170d0bf050606ea9c
Content-Type: text/plain; charset=UTF-8
On 22 October 2014 12:10, <contact@ncomputers.org> wrote:
> To declare the local variables inside each function requires time.
But in good C++ code, 99% of local variables should be declared at the
point of first use. Prototyping is not an excuse to write bad code.
--
Nevin ":-)" Liber <mailto:nevin@eviloverlord.com> (847) 691-1404
--
---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
--f46d0438903170d0bf050606ea9c
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><div class=3D"gmail_extra">On 22 October 2014 12:10, <spa=
n dir=3D"ltr"><<a href=3D"mailto:contact@ncomputers.org" target=3D"_blan=
k">contact@ncomputers.org</a>></span> wrote:<br><div class=3D"gmail_quot=
e"><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left=
:1px #ccc solid;padding-left:1ex">To declare the local variables inside eac=
h function requires time.</blockquote></div><div class=3D"gmail_extra"><br>=
</div>But in good C++ code, 99% of local variables should be declared at th=
e point of first use.=C2=A0 Prototyping is not an excuse to write bad code.=
</div><div class=3D"gmail_extra">-- <br>=C2=A0Nevin ":-)" Liber=
=C2=A0 <mailto:<a href=3D"mailto:nevin@eviloverlord.com" target=3D"_blan=
k">nevin@eviloverlord.com</a>>=C2=A0 (847) 691-1404
</div></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
--f46d0438903170d0bf050606ea9c--
.
Author: Michael Bruck <bruck.michael@gmail.com>
Date: Wed, 22 Oct 2014 12:18:54 -0700 (PDT)
Raw View
------=_Part_244_1644627804.1414005534876
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
On Wednesday, October 22, 2014 6:05:10 PM UTC+2, David Rodr=C3=ADguez Ibeas=
=20
wrote:
>
> I don't find Michael's example of 'tetris_t' particularly compelling,=20
> since it seems to be throwing a bunch of unrelated functionality into a=
=20
> single class and using prefixes to separate behavior. I consider that a b=
ad=20
> design and I'd argue that modifying the language to simplify bad designs =
is=20
> not really a good goal. If anything, bad designs should be *harder*, not=
=20
> *simpler* to implement.
>
>
The language is encouraging this design because the alternatives come with=
=20
a performance penalty. I would prefer sane mixins, but they come with a=20
whole new set of issues.
Michael
--=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
------=_Part_244_1644627804.1414005534876
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br>On Wednesday, October 22, 2014 6:05:10 PM UTC+2, David=
Rodr=C3=ADguez Ibeas wrote:<blockquote class=3D"gmail_quote" style=3D"marg=
in: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><d=
iv dir=3D"ltr"><div>I don't find Michael's example of 'tetris_t' particular=
ly compelling, since it seems to be throwing a bunch of unrelated functiona=
lity into a single class and using prefixes to separate behavior. I conside=
r that a bad design and I'd argue that modifying the language to simplify b=
ad designs is not really a good goal. If anything, bad designs should be *h=
arder*, not *simpler* to implement.<br><br></div></div></blockquote><div><b=
r></div><div>The language is encouraging this design because the alternativ=
es come with a performance penalty. I would prefer sane mixins, but they co=
me with a whole new set of issues.</div><div><br></div><div><br></div><div>=
Michael</div></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_244_1644627804.1414005534876--
.
Author: "Daniel Gutson" <danielgutson@gmail.com>
Date: Thu, 23 Oct 2014 04:58:50 +0000
Raw View
--part1963-boundary-480295722-1095069135
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8
I still think that there is no need to see anecdotic code. Please answer my=
question from an analytical point of view: why helper class or delegator p=
attern don't solve your issue.
-----Original Message-----
From: contact@ncomputers.org
Date: Wed, 22 Oct 2014 10:55:42=20
To: <std-proposals@isocpp.org>
Reply-To: std-proposals@isocpp.org
Cc: <dibeas@ieee.org>
Subject: Re: [std-proposals] Nested namespaces by classes
Thank you very much for your time and your answer!
This is a symptom of bad design: too many local variables, moreover=20
> repeated in a subset of methods.=20
The local variables are required.
To avoid the repetition, *nested namespaces* would be useful.
This is a symptom of bad design: too many local variables, moreover=20
> repeated in a subset of methods.=20
> It's an indication that a delegation or helper class may be needed.=20
> I don't see any need for a language extension, but a good design practice=
..=20
> Please explain why the helper class idiom or the delegator pattern=20
> don't solve the problem I assume you are trying to solve. =20
>
I can understand, that because I haven't published the code yet, you can=20
suppose that its design is bad. I invite you to be patient. I invite to=20
wait me a few weeks.
El mi=C3=A9rcoles, 22 de octubre de 2014 12:28:30 UTC-5, dgutson escribi=C3=
=B3:
>
> On Wed, Oct 22, 2014 at 1:34 PM, <con...@ncomputers.org <javascript:>>=
=20
> wrote:=20
> > David,=20
> >=20
> > Thank you very much for your answer.=20
> >=20
> >> When providing a motivating example, I would go the extra mile and=20
> provide=20
> >> how this would look in the new design.=20
> >=20
> >=20
> > Ok, this is how it would be:=20
> >=20
> > Without nested namespaces:=20
> >=20
> >=20
> > template<typename P,typename E>=20
> > class GC{=20
> > void function_1(){=20
> > C*c1,*c0,**cc0,**cc1;=20
> > P e,p,*p0,*p1;=20
> > V*v0;=20
> > }=20
>
> This is a symptom of bad design: too many local variables, moreover=20
> repeated in a subset of methods.=20
> It's an indication that a delegation or helper class may be needed.=20
> I don't see any need for a language extension, but a good design practice=
..=20
> Please explain why the helper class idiom or the delegator pattern=20
> don't solve the problem I assume you are trying to solve.=20
>
> >=20
> > void function_2(){=20
> > C*c0,*c1,*c2,**cc0,**cc1;=20
> > H*h0,*h1,**hh0;=20
> > P e,p,*p0,*p1;=20
> > V*v0;=20
> > }=20
> >=20
> > void function_3(){=20
> > C*c0,*c1,*c2;=20
> > H*h0;=20
> > H***hhh0;=20
> > V*v0;=20
> > P e,*p0,*p1;=20
> > }=20
> >=20
> > void function_4(){=20
> > C*c0,*c1;=20
> > H**hh0;=20
> > P e,p,*p0,*p1;=20
> > V*v0;=20
> > }=20
> >=20
> > void function_5(){=20
> > C**cc0,**cc1;=20
> > }=20
> >=20
> > void function_6(){=20
> > H*h0,*h1,*h2;=20
> > P p,e,a;=20
> > P*p0;=20
> > H**hh0;=20
> > V**vv0;=20
> > }=20
> >=20
> > void function_7(){=20
> > C**cc0,**cc1;=20
> > H**hh0,**hh1;=20
> > }=20
> > };=20
> >=20
> > With nested namespaces:=20
> >=20
> > template<typename P,typename E>=20
> > class GC{=20
> > namespace variables{=20
> > C*c0,*c1,*c2,**cc0,**cc1;=20
> > H*h0,*h1,*h2,**hh0,**hh1,***hhh0;=20
> > P e,p,a,*p0,*p1;=20
> > V*v0,**vv0;=20
> > }=20
> >=20
> > void function_1(){=20
> > using namespace variables;=20
> > }=20
> >=20
> > void function_2(){=20
> > using namespace variables;=20
> > }=20
> >=20
> > void function_3(){=20
> > using namespace variables;=20
> > }=20
> >=20
> > void function_4(){=20
> > using namespace variables;=20
> > }=20
> >=20
> > void function_5(){=20
> > using namespace variables;=20
> > }=20
> >=20
> > void function_6(){=20
> > using namespace variables;=20
> > }=20
> >=20
> > void function_7(){=20
> > using namespace variables;=20
> > }=20
> > };=20
> >=20
> > El mi=C3=A9rcoles, 22 de octubre de 2014 11:05:10 UTC-5, David Rodr=C3=
=ADguez=20
> Ibeas=20
> > escribi=C3=B3:=20
> >>=20
> >> When providing a motivating example, I would go the extra mile and=20
> provide=20
> >> how this would look in the new design.=20
> >>=20
> >> Other than that, the comments and examples lead me to think this is=20
> really=20
> >> a couple of conflicting things... In this last example, all of the=20
> variables=20
> >> are local to each function, while the modified design would make them=
=20
> >> members of the class. This is an important change in the design, as it=
=20
> makes=20
> >> that additional data persistent beyond the function call (additional=
=20
> memory=20
> >> requirements) and prone to side effects from other functions. If one=
=20
> >> function above calls another and it does not pass pointers or=20
> references to=20
> >> its local variables it is clear both to the developer (understanding o=
f=20
> >> code) and the compiler (optimizing code) that the variable is not=20
> modified=20
> >> externally. Once you move those local variables to the object, that is=
=20
> no=20
> >> longer the case. Furthermore, it opens the door to subtle bugs where=
=20
> during=20
> >> maintenance the called function starts modifying part of the temporary=
=20
> state=20
> >> and affects the behavior of the callee.=20
> >>=20
> >> Regarding lookup, and on the comments above that the use of nested=20
> types=20
> >> (they really need not be nested, but members of a struct type anyways)=
,=20
> if=20
> >> the only issue is with the additional name of the member there could b=
e=20
> >> other alternatives that are simpler to understand and less error prone=
..=20
> For=20
> >> example, and I am sure this has been proposed before, you could modify=
=20
> >> lookup to avoid the need of the name (from the example using 'struct A=
'=20
> in a=20
> >> previous message):=20
> >>=20
> >> void foo();=20
> >> struct A {=20
> >> struct Nested { int Signed; unsigned Unsigned; } o_nested;=20
> >> int x;=20
> >> A() {=20
> >> using o_nested {=20
> >> Unsigned =3D 5;=20
> >> x =3D -1;=20
> >> foo();=20
> >> }=20
> >> }=20
> >> };=20
> >>=20
> >> Where the 'using' above would affect unqualified lookup by forcing the=
=20
> >> lookup of the name to first check as a member of 'o_nested' (in the=20
> same way=20
> >> that 'this' is checked for unqualified lookup inside a member) for=20
> >> 'Unsigned', if that is not found it would move up to the class scope a=
s=20
> for=20
> >> 'x' or move further out according to the existing lookup rules.=20
> >>=20
> >> I don't find Michael's example of 'tetris_t' particularly compelling,=
=20
> >> since it seems to be throwing a bunch of unrelated functionality into =
a=20
> >> single class and using prefixes to separate behavior. I consider that =
a=20
> bad=20
> >> design and I'd argue that modifying the language to simplify bad=20
> designs is=20
> >> not really a good goal. If anything, bad designs should be *harder*,=
=20
> not=20
> >> *simpler* to implement.=20
> >>=20
> >> Summarizing: If the goal is to substitute packs of local variables tha=
t=20
> >> are commonly aggregated in functions, this is a horrible solution.=20
> Create a=20
> >> type and have a local instance of the type. If the goal is to separate=
=20
> >> concerns and group related *members*, then using a type and a member o=
f=20
> the=20
> >> type seem like a more reasonable solution, if the burden of typing the=
=20
> >> member name is deemed big, a small modification to look up *in the=20
> scope of=20
> >> the code that uses it* seems like a narrower and simpler change.=20
> >>=20
> >> David=20
> >>=20
> >> On Wed, Oct 22, 2014 at 12:52 AM, <con...@ncomputers.org> wrote:=20
> >>>=20
> >>> Jens,=20
> >>>=20
> >>> I've found how to give you a better example.=20
> >>>=20
> >>> I will only copy the declaration of the variables of my code. (Graph=
=20
> >>> Coloring.cpp)=20
> >>>=20
> >>>> A key property to prototyping is the fact that it is supposed to be=
=20
> done=20
> >>>> quickly.=20
> >>>=20
> >>>=20
> >>> I have been working on this code for more than three months. I make a=
=20
> >>> prototype, I change it, make a new, change it again, and so on. It=20
> would=20
> >>> help me a lot to have nested namespaces. Instead of declaring all=20
> variables=20
> >>> inside each function, I would declare it inside a nested namespace (t=
o=20
> avoid=20
> >>> confusions if they were direct members of the object) and when I have=
=20
> a=20
> >>> final prototype, refactor the code.=20
> >>>=20
> >>> (These are segments of functions (that run at different runtimes) of =
a=20
> >>> real code with a real application):=20
> >>>=20
> >>> template<typename P,typename E>=20
> >>> class GC{=20
> >>> void function_1(){=20
> >>> C*c1,*c0,**cc0,**cc1;=20
> >>> P e,p,*p0,*p1;=20
> >>> V*v0;=20
> >>> }=20
> >>>=20
> >>> void function_2(){=20
> >>> C*c0,*c1,*c2,**cc0,**cc1;=20
> >>> H*h0,*h1,**hh0;=20
> >>> P e,p,*p0,*p1;=20
> >>> V*v0;=20
> >>> }=20
> >>>=20
> >>> void function_3(){=20
> >>> C*c0,*c1,*c2;=20
> >>> H*h0;=20
> >>> H***hhh0;=20
> >>> V*v0;=20
> >>> P e,*p0,*p1;=20
> >>> }=20
> >>>=20
> >>> void function_4(){=20
> >>> C*c0,*c1;=20
> >>> H**hh0;=20
> >>> P e,p,*p0,*p1;=20
> >>> V*v0;=20
> >>> }=20
> >>>=20
> >>> void function_5(){=20
> >>> C**cc0,**cc1;=20
> >>> }=20
> >>>=20
> >>> void function_6(){=20
> >>> H*h0,*h1,*h2;=20
> >>> P p,e,a;=20
> >>> P*p0;=20
> >>> H**hh0;=20
> >>> V**vv0;=20
> >>> }=20
> >>>=20
> >>> void function_7(){=20
> >>> C**cc0,**cc1;=20
> >>> H**hh0,**hh1;=20
> >>> }=20
> >>> };=20
> >>>=20
> >>> Reference: http://en.wikipedia.org/wiki/Software_prototyping=20
> >>>=20
> >>> El martes, 21 de octubre de 2014 13:23:14 UTC-5, Jens Maurer escribi=
=C3=B3:=20
> >>>>=20
> >>>> On 10/21/2014 07:47 PM, con...@ncomputers.org wrote:=20
> >>>> > void vertices(){=20
> >>>> > P*p0,*p1;=20
> >>>> > //Variables=20
> >>>> > cout<<this->rn<<" vertices with edges:";=20
> >>>> >=20
> >>>> > for(p0=3Dthis->ra,p1=3Dthis->rz;p0<p1;)cout<<*p0++<<',';cout<<endl=
;=20
> >>>> > cout<<this->in<<" vertices without edges:";=20
> >>>> >=20
> >>>> > for(p0=3Dthis->ia,p1=3Dthis->iz;p0<p1;)cout<<*--p1<<',';cout<<endl=
;=20
> >>>>=20
> >>>> I'd recommend investing in a space key. This is unreadable.=20
> >>>>=20
> >>>> Thanks,=20
> >>>> Jens=20
> >>>>=20
> >>> --=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, sen=
d=20
> an=20
> >>> email to std-proposal...@isocpp.org.=20
> >>> To post to this group, send email to std-pr...@isocpp.org.=20
> >>> Visit this group at=20
> >>> http://groups.google.com/a/isocpp.org/group/std-proposals/.=20
> >>=20
> >>=20
> > --=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
>
> > Visit this group at=20
> > http://groups.google.com/a/isocpp.org/group/std-proposals/.=20
>
>
>
> --=20
> Who=E2=80=99s got the sweetest disposition?=20
> One guess, that=E2=80=99s who?=20
> Who=E2=80=99d never, ever start an argument?=20
> Who never shows a bit of temperament?=20
> Who's never wrong but always right?=20
> Who'd never dream of starting a fight?=20
> Who get stuck with all the bad luck?=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
--=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
--part1963-boundary-480295722-1095069135
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><=
meta content=3D"text/html; charset=3Dutf-8" http-equiv=3D"Content-Type"></h=
ead><body>I still think that there is no need to see anecdotic code. Please=
answer my question from an analytical point of view: why helper class or d=
elegator pattern don't solve your issue.<hr/><div><b>From: </b> contact@nco=
mputers.org
</div><div><b>Date: </b>Wed, 22 Oct 2014 10:55:42 -0700 (PDT)</div><div><b>=
To: </b><std-proposals@isocpp.org></div><div><b>ReplyTo: </b> std-pro=
posals@isocpp.org
</div><div><b>Cc: </b><dibeas@ieee.org></div><div><b>Subject: </b>Re:=
[std-proposals] Nested namespaces by classes</div><div><br/></div><div dir=
=3D"ltr">Thank you very much for your time and your answer!<br><br><blockqu=
ote style=3D"margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204=
, 204); padding-left: 1ex;" class=3D"gmail_quote">This is a symptom of bad =
design: too many local variables, moreover
<br>repeated in a subset of methods.
</blockquote><div><br>The local variables are required.<br><br>To avoid the=
repetition, <b>nested namespaces</b> would be useful.<br><br><blockquote s=
tyle=3D"margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204=
); padding-left: 1ex;" class=3D"gmail_quote">This is a symptom of bad desig=
n: too many local variables, moreover
<br>repeated in a subset of methods.
<br>It's an indication that a delegation or helper class may be needed.
<br>I don't see any need for a language extension, but a good design practi=
ce.
<br>Please explain why the helper class idiom or the delegator pattern
<br>don't solve the problem I assume you are trying to solve.
<br></blockquote><div><br>I can understand, that because I haven't pu=
blished the code yet, you can suppose that its design is bad. I invite you =
to be patient. I invite to wait me a few weeks.<br></div></div><br>El mi=C3=
=A9rcoles, 22 de octubre de 2014 12:28:30 UTC-5, dgutson escribi=C3=B3:<blo=
ckquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-=
left: 1px #ccc solid;padding-left: 1ex;">On Wed, Oct 22, 2014 at 1:34 PM, &=
nbsp;<<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D=
"3s8A0Wr_880J" onmousedown=3D"this.href=3D'javascript:';return true;" oncli=
ck=3D"this.href=3D'javascript:';return true;">con...@ncomputers.org</a>>=
wrote:
<br>> David,
<br>>
<br>> Thank you very much for your answer.
<br>>
<br>>> When providing a motivating example, I would go the extra mile=
and provide
<br>>> how this would look in the new design.
<br>>
<br>>
<br>> Ok, this is how it would be:
<br>>
<br>> Without nested namespaces:
<br>>
<br>>
<br>> template<typename P,typename E>
<br>> class GC{
<br>> void function_1(){
<br>> C*c1,*c0,**cc0,**cc1;
<br>> P e,p,*p0,*p1;
<br>> V*v0;
<br>> }
<br>
<br>This is a symptom of bad design: too many local variables, moreover
<br>repeated in a subset of methods.
<br>It's an indication that a delegation or helper class may be needed.
<br>I don't see any need for a language extension, but a good design practi=
ce.
<br>Please explain why the helper class idiom or the delegator pattern
<br>don't solve the problem I assume you are trying to solve.
<br>
<br>>
<br>> void function_2(){
<br>> C*c0,*c1,*c2,**cc0,**cc1;
<br>> H*h0,*h1,**hh0;
<br>> P e,p,*p0,*p1;
<br>> V*v0;
<br>> }
<br>>
<br>> void function_3(){
<br>> C*c0,*c1,*c2;
<br>> H*h0;
<br>> H***hhh0;
<br>> V*v0;
<br>> P e,*p0,*p1;
<br>> }
<br>>
<br>> void function_4(){
<br>> C*c0,*c1;
<br>> H**hh0;
<br>> P e,p,*p0,*p1;
<br>> V*v0;
<br>> }
<br>>
<br>> void function_5(){
<br>> C**cc0,**cc1;
<br>> }
<br>>
<br>> void function_6(){
<br>> H*h0,*h1,*h2;
<br>> P p,e,a;
<br>> P*p0;
<br>> H**hh0;
<br>> V**vv0;
<br>> }
<br>>
<br>> void function_7(){
<br>> C**cc0,**cc1;
<br>> H**hh0,**hh1;
<br>> }
<br>> };
<br>>
<br>> With nested namespaces:
<br>>
<br>> template<typename P,typename E>
<br>> class GC{
<br>> namespace variables{
<br>> C*c0,*c1,*c2,**cc0,**cc1;
<br>> H*h0,*h1,*h2,**hh0,**hh1,***<wbr>hhh0;
<br>> P e,p,a,*p0,*p1;
<br>> V*v0,**vv0;
<br>> }
<br>>
<br>> void function_1(){
<br>> using namespace variables;
<br>> }
<br>>
<br>> void function_2(){
<br>> using namespace variables;
<br>> }
<br>>
<br>> void function_3(){
<br>> using namespace variables;
<br>> }
<br>>
<br>> void function_4(){
<br>> using namespace variables;
<br>> }
<br>>
<br>> void function_5(){
<br>> using namespace variables;
<br>> }
<br>>
<br>> void function_6(){
<br>> using namespace variables;
<br>> }
<br>>
<br>> void function_7(){
<br>> using namespace variables;
<br>> }
<br>> };
<br>>
<br>> El mi=C3=A9rcoles, 22 de octubre de 2014 11:05:10 UTC-5, David Rod=
r=C3=ADguez Ibeas
<br>> escribi=C3=B3:
<br>>>
<br>>> When providing a motivating example, I would go the extra mile=
and provide
<br>>> how this would look in the new design.
<br>>>
<br>>> Other than that, the comments and examples lead me to think th=
is is really
<br>>> a couple of conflicting things... In this last example, all of=
the variables
<br>>> are local to each function, while the modified design would ma=
ke them
<br>>> members of the class. This is an important change in the desig=
n, as it makes
<br>>> that additional data persistent beyond the function call (addi=
tional memory
<br>>> requirements) and prone to side effects from other functions. =
If one
<br>>> function above calls another and it does not pass pointers or =
references to
<br>>> its local variables it is clear both to the developer (underst=
anding of
<br>>> code) and the compiler (optimizing code) that the variable is =
not modified
<br>>> externally. Once you move those local variables to the object,=
that is no
<br>>> longer the case. Furthermore, it opens the door to subtle bugs=
where during
<br>>> maintenance the called function starts modifying part of the t=
emporary state
<br>>> and affects the behavior of the callee.
<br>>>
<br>>> Regarding lookup, and on the comments above that the use of ne=
sted types
<br>>> (they really need not be nested, but members of a struct type =
anyways), if
<br>>> the only issue is with the additional name of the member there=
could be
<br>>> other alternatives that are simpler to understand and less err=
or prone. For
<br>>> example, and I am sure this has been proposed before, you coul=
d modify
<br>>> lookup to avoid the need of the name (from the example using '=
struct A' in a
<br>>> previous message):
<br>>>
<br>>> void foo();
<br>>> struct A {
<br>>> struct Nested { int Signed; unsigned Unsig=
ned; } o_nested;
<br>>> int x;
<br>>> A() {
<br>>> using o_nested {
<br>>> Unsigned =3D =
5;
<br>>> x =3D -1;
<br>>> foo();
<br>>> }
<br>>> }
<br>>> };
<br>>>
<br>>> Where the 'using' above would affect unqualified lookup by for=
cing the
<br>>> lookup of the name to first check as a member of 'o_nested' (i=
n the same way
<br>>> that 'this' is checked for unqualified lookup inside a member)=
for
<br>>> 'Unsigned', if that is not found it would move up to the class=
scope as for
<br>>> 'x' or move further out according to the existing lookup rules=
..
<br>>>
<br>>> I don't find Michael's example of 'tetris_t' particularly comp=
elling,
<br>>> since it seems to be throwing a bunch of unrelated functionali=
ty into a
<br>>> single class and using prefixes to separate behavior. I consid=
er that a bad
<br>>> design and I'd argue that modifying the language to simplify b=
ad designs is
<br>>> not really a good goal. If anything, bad designs should be *ha=
rder*, not
<br>>> *simpler* to implement.
<br>>>
<br>>> Summarizing: If the goal is to substitute packs of local varia=
bles that
<br>>> are commonly aggregated in functions, this is a horrible solut=
ion. Create a
<br>>> type and have a local instance of the type. If the goal is to =
separate
<br>>> concerns and group related *members*, then using a type and a =
member of the
<br>>> type seem like a more reasonable solution, if the burden of ty=
ping the
<br>>> member name is deemed big, a small modification to look up *in=
the scope of
<br>>> the code that uses it* seems like a narrower and simpler chang=
e.
<br>>>
<br>>> David
<br>>>
<br>>> On Wed, Oct 22, 2014 at 12:52 AM, <<a>con...@ncomputers.org=
</a>> wrote:
<br>>>>
<br>>>> Jens,
<br>>>>
<br>>>> I've found how to give you a better example.
<br>>>>
<br>>>> I will only copy the declaration of the variables of my co=
de. (Graph
<br>>>> Coloring.cpp)
<br>>>>
<br>>>>> A key property to prototyping is the fact that it is s=
upposed to be done
<br>>>>> quickly.
<br>>>>
<br>>>>
<br>>>> I have been working on this code for more than three month=
s. I make a
<br>>>> prototype, I change it, make a new, change it again, and s=
o on. It would
<br>>>> help me a lot to have nested namespaces. Instead of declar=
ing all variables
<br>>>> inside each function, I would declare it inside a nested n=
amespace (to avoid
<br>>>> confusions if they were direct members of the object) and =
when I have a
<br>>>> final prototype, refactor the code.
<br>>>>
<br>>>> (These are segments of functions (that run at different ru=
ntimes) of a
<br>>>> real code with a real application):
<br>>>>
<br>>>> template<typename P,typename E>
<br>>>> class GC{
<br>>>> void function_1(){
<br>>>> C*c1,*c0,**cc0,**cc1;
<br>>>> P e,p,*p0,*p1;
<br>>>> V*v0;
<br>>>> }
<br>>>>
<br>>>> void function_2(){
<br>>>> C*c0,*c1,*c2,**cc0,**cc1;
<br>>>> H*h0,*h1,**hh0;
<br>>>> P e,p,*p0,*p1;
<br>>>> V*v0;
<br>>>> }
<br>>>>
<br>>>> void function_3(){
<br>>>> C*c0,*c1,*c2;
<br>>>> H*h0;
<br>>>> H***hhh0;
<br>>>> V*v0;
<br>>>> P e,*p0,*p1;
<br>>>> }
<br>>>>
<br>>>> void function_4(){
<br>>>> C*c0,*c1;
<br>>>> H**hh0;
<br>>>> P e,p,*p0,*p1;
<br>>>> V*v0;
<br>>>> }
<br>>>>
<br>>>> void function_5(){
<br>>>> C**cc0,**cc1;
<br>>>> }
<br>>>>
<br>>>> void function_6(){
<br>>>> H*h0,*h1,*h2;
<br>>>> P p,e,a;
<br>>>> P*p0;
<br>>>> H**hh0;
<br>>>> V**vv0;
<br>>>> }
<br>>>>
<br>>>> void function_7(){
<br>>>> C**cc0,**cc1;
<br>>>> H**hh0,**hh1;
<br>>>> }
<br>>>> };
<br>>>>
<br>>>> Reference: <a href=3D"http://en.wikipedia.org/wiki/Softwar=
e_prototyping" target=3D"_blank" onmousedown=3D"this.href=3D'http://www.goo=
gle.com/url?q\75http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FSoftware_prototyping=
\46sa\75D\46sntz\0751\46usg\75AFQjCNF0oTeXY9CCp0DlQkC9b9DYI0jdwA';return tr=
ue;" onclick=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fen.=
wikipedia.org%2Fwiki%2FSoftware_prototyping\46sa\75D\46sntz\0751\46usg\75AF=
QjCNF0oTeXY9CCp0DlQkC9b9DYI0jdwA';return true;">http://en.wikipedia.org/wik=
i/<wbr>Software_prototyping</a>
<br>>>>
<br>>>> El martes, 21 de octubre de 2014 13:23:14 UTC-5, Jens Maur=
er escribi=C3=B3:
<br>>>>>
<br>>>>> On 10/21/2014 07:47 PM, <a>con...@ncomputers.org</a> w=
rote:
<br>>>>> > void vertices(){
<br>>>>> > P*p0,*p1;
<br>>>>> > //Variables
<br>>>>> > cout<<this->=
rn<<" vertices with edges:";
<br>>>>> >
<br>>>>> > for(p0=3Dthis->ra,p1=3Dthis->rz;<wbr>p0<=
p1;)cout<<*p0++<<',';cout<<<wbr>endl;
<br>>>>> > cout<<this->=
in<<" vertices without edges:";
<br>>>>> >
<br>>>>> > for(p0=3Dthis->ia,p1=3Dthis->iz;<wbr>p0<=
p1;)cout<<*--p1<<',';cout<<<wbr>endl;
<br>>>>>
<br>>>>> I'd recommend investing in a space key. This is =
unreadable.
<br>>>>>
<br>>>>> Thanks,
<br>>>>> Jens
<br>>>>>
<br>>>> --
<br>>>>
<br>>>> ---
<br>>>> You received this message because you are subscribed to th=
e Google Groups
<br>>>> "ISO C++ Standard - Future Proposals" group.
<br>>>> To unsubscribe from this group and stop receiving emails f=
rom it, send an
<br>>>> email to <a>std-proposal...@isocpp.org</a>.
<br>>>> To post to this group, send email to <a>std-pr...@isocpp.o=
rg</a>.
<br>>>> Visit this group at
<br>>>> <a href=3D"http://groups.google.com/a/isocpp.org/group/std=
-proposals/" target=3D"_blank" onmousedown=3D"this.href=3D'http://groups.go=
ogle.com/a/isocpp.org/group/std-proposals/';return true;" onclick=3D"this.h=
ref=3D'http://groups.google.com/a/isocpp.org/group/std-proposals/';return t=
rue;">http://groups.google.com/a/<wbr>isocpp.org/group/std-<wbr>proposals/<=
/a>.
<br>>>
<br>>>
<br>> --
<br>>
<br>> ---
<br>> You received this message because you are subscribed to the Google=
Groups
<br>> "ISO C++ Standard - Future Proposals" group.
<br>> To unsubscribe from this group and stop receiving emails from it, =
send an
<br>> email to <a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-=
mailto=3D"3s8A0Wr_880J" onmousedown=3D"this.href=3D'javascript:';return tru=
e;" onclick=3D"this.href=3D'javascript:';return true;">std-proposal...@<wbr=
>isocpp.org</a>.
<br>> To post to this group, send email to <a href=3D"javascript:" targe=
t=3D"_blank" gdf-obfuscated-mailto=3D"3s8A0Wr_880J" onmousedown=3D"this.hre=
f=3D'javascript:';return true;" onclick=3D"this.href=3D'javascript:';return=
true;">std-pr...@isocpp.org</a>.
<br>> Visit this group at
<br>> <a href=3D"http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/" target=3D"_blank" onmousedown=3D"this.href=3D'http://groups.google.com=
/a/isocpp.org/group/std-proposals/';return true;" onclick=3D"this.href=3D'h=
ttp://groups.google.com/a/isocpp.org/group/std-proposals/';return true;">ht=
tp://groups.google.com/a/<wbr>isocpp.org/group/std-<wbr>proposals/</a>.
<br>
<br>
<br>
<br>--=20
<br>Who=E2=80=99s got the sweetest disposition?
<br>One guess, that=E2=80=99s who?
<br>Who=E2=80=99d never, ever start an argument?
<br>Who never shows a bit of temperament?
<br>Who's never wrong but always right?
<br>Who'd never dream of starting a fight?
<br>Who get stuck with all the bad luck?
<br></blockquote></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
</body></html>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
--part1963-boundary-480295722-1095069135--
.
Author: Michael Bruck <bruck.michael@gmail.com>
Date: Thu, 23 Oct 2014 04:15:15 -0700 (PDT)
Raw View
------=_Part_279_371307140.1414062915612
Content-Type: text/plain; charset=UTF-8
On Thursday, October 23, 2014 6:59:00 AM UTC+2, dgutson wrote:
>
> I still think that there is no need to see anecdotic code. Please answer
> my question from an analytical point of view: why helper class or delegator
> pattern don't solve your issue.
>
Probably because they are inefficient.
Michael
--
---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_279_371307140.1414062915612
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><br><br>On Thursday, October 23, 2014 6:59:00 AM UTC+2, dg=
utson wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-lef=
t: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div>I still think=
that there is no need to see anecdotic code. Please answer my question fro=
m an analytical point of view: why helper class or delegator pattern don't =
solve your issue.</div></blockquote><div><br></div><div>Probably because th=
ey are inefficient.</div><div><br></div><div>Michael</div></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_279_371307140.1414062915612--
.
Author: contact@ncomputers.org
Date: Thu, 23 Oct 2014 10:21:47 -0700 (PDT)
Raw View
------=_Part_298_1388804589.1414084907823
Content-Type: text/plain; charset=UTF-8
Nevin, thank you very much for your answer.
But in good C++ code, 99% of local variables should be declared at the
> point of first use.
I agree partially with it. When writing a release version, I would declare
variables at the point of first use. David's proposal could be useful for
this. (Using objects as namespace)
For example:
template<typename P,typename E>
class GC{
struct variables{
C*c0,*c1,*c2,**cc0,**cc1;
H*h0,*h1,*h2,**hh0,**hh1,***hhh0;
P e,p,a,*p0,*p1;
V*v0,**vv0;
}
void function_1(){
using variables as_namespace;
}
};
Prototyping is not an excuse to write bad code.
I understand that my codes or my style for programming could be considered
as bad. Prototyping for me is a very strong reason to suggest this
improvement. Seen from my point of view. The prototypes must be easy to
change, instead of be perfect codes.
Best regards,
PF, ncomputers
On 22 October 2014 13:14:18 UTC-5 Nevin ":-)" Liber wrote:
>
> On 22 October 2014 12:10, <con...@ncomputers.org <javascript:>> wrote:
>
>> To declare the local variables inside each function requires time.
>
>
> But in good C++ code, 99% of local variables should be declared at the
> point of first use. Prototyping is not an excuse to write bad code.
> --
> Nevin ":-)" Liber <mailto:ne...@eviloverlord.com <javascript:>> (847)
> 691-1404
>
--
---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_298_1388804589.1414084907823
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Nevin, thank you very much for your answer.<br><br><blockq=
uote style=3D"margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 20=
4, 204); padding-left: 1ex;" class=3D"gmail_quote">But in good C++ code, 99=
% of local variables should be declared at the point of first use.</blockqu=
ote><div><br>I agree partially with it. When writing a release version, I w=
ould declare variables at the point of first use. David's proposal could b=
e useful for this. (Using objects as namespace) <br><br>For example:<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><div class=3D"GBT2DCHDHLB"><span style=3D"color:#008"><span style=3D"col=
or: #008;" class=3D"styled-by-prettify">template</span></span><span style=
=3D"color:#660"><span style=3D"color: #660;" class=3D"styled-by-prettify">&=
lt;</span></span><span style=3D"color:#008"><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">typename</span></span><span style=3D"color:#000"=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> P</span></span>=
<span style=3D"color:#660"><span style=3D"color: #660;" class=3D"styled-by-=
prettify">,</span></span><span style=3D"color:#008"><span style=3D"color: #=
008;" class=3D"styled-by-prettify">typename</span></span><span style=3D"col=
or:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify"> E</span=
></span><span style=3D"color:#660"><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">></span></span><span style=3D"color:#000"><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br></span></span><span styl=
e=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"> GC</span></span><span style=3D"color:#660"><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">{</span></span></di=
v><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> struct</span></span><span style=3D"color:#008"><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify"></span></span><span=
style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> variables</span></span><span style=3D"color:#660"><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">{</span></span><span style=3D"color:=
#000"><span style=3D"color: #000;" class=3D"styled-by-prettify"><br> =
C</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">c=
0</span></span><span style=3D"color:#660"><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">,*</span></span><span style=3D"color:#000"><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify">c1</span></span><span st=
yle=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;" c=
lass=3D"styled-by-prettify">c2</span></span><span style=3D"color:#660"><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">,**</span></span><spa=
n style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-pret=
tify">cc0</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">cc1</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> H</spa=
n></span><span style=3D"color:#660"><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">*</span></span><span style=3D"color:#000"><span style=3D=
"color: #000;" class=3D"styled-by-prettify">h0</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">h1</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">h=
2</span></span><span style=3D"color:#660"><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">,**</span></span><span style=3D"color:#000"><span =
style=3D"color: #000;" class=3D"styled-by-prettify">hh0</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 style=3D"color: #000;=
" class=3D"styled-by-prettify">hh1</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">hh</span><wbr><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify">h0</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>  =
; P e</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">p</span=
></span><span style=3D"color:#660"><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">,</span></span><span style=3D"color:#000"><span style=3D"=
color: #000;" class=3D"styled-by-prettify">a</span></span><span style=3D"co=
lor:#660"><span style=3D"color: #660;" class=3D"styled-by-prettify">,*</spa=
n></span><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify">p0</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">p=
1</span></span><span style=3D"color:#660"><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">;</span></span><span style=3D"color:#000"><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"><br> =
V</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">v0</span></span><s=
pan style=3D"color:#660"><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">,**</span></span><span style=3D"color:#000"><span style=3D"color: #=
000;" class=3D"styled-by-prettify">vv0</span></span><span style=3D"color:#6=
60"><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span></spa=
n><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"><br> </span></span><span style=3D"color:#660"><spa=
n 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-pretti=
fy"><br><br> </span></span><span style=3D"color:#008"><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">void</span></span><span s=
tyle=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> function_1</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 style=3D"color: #000;" class=3D"styled-by-prettify"></span></span><c=
ode class=3D"prettyprint"><code><span style=3D"color:#000"><span style=3D"c=
olor: #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">using</span></span><span style=3D"color:#000"><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span></span><span style=
=3D"color:#008"><span style=3D"color: #606;" class=3D"styled-by-prettify">v=
ariables</span></span><span style=3D"color:#000"><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">as_namespace</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"></span></span></code></code><span style=3D"color:#000"><span styl=
e=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><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;" cl=
ass=3D"styled-by-prettify">};</span></span><span style=3D"color:#000"><span=
style=3D"color: #000;" class=3D"styled-by-prettify"><br></span></span></di=
v></code></div></div></code></div></div><br><blockquote style=3D"margin: 0p=
x 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1=
ex;" class=3D"gmail_quote">Prototyping is not an excuse to write bad code.<=
/blockquote><div><br>I understand that my codes or my style for programming=
could be considered as bad. Prototyping for me is a very strong reason to =
suggest this improvement. Seen from my point of view. The prototypes must b=
e easy to change, instead of be perfect codes.<br><br>Best regards,<br><br>=
PF, ncomputers<br></div><br>On 22 October 2014 13:14:18 UTC-5 Nevin ":-)" L=
iber wrote:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left=
: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><d=
iv>On 22 October 2014 12:10, <span dir=3D"ltr"><<a href=3D"javascript:"=
target=3D"_blank" gdf-obfuscated-mailto=3D"WlIs9xs643wJ" onmousedown=3D"th=
is.href=3D'javascript:';return true;" onclick=3D"this.href=3D'javascript:';=
return true;">con...@ncomputers.org</a>></span> wrote:<br><div class=3D"=
gmail_quote"><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;b=
order-left:1px #ccc solid;padding-left:1ex">To declare the local variables =
inside each function requires time.</blockquote></div><div><br></div>But in=
good C++ code, 99% of local variables should be declared at the point of f=
irst use. Prototyping is not an excuse to write bad code.</div><div>-=
- <br> Nevin ":-)" Liber <mailto:<a href=3D"javascript:" targ=
et=3D"_blank" gdf-obfuscated-mailto=3D"WlIs9xs643wJ" onmousedown=3D"this.hr=
ef=3D'javascript:';return true;" onclick=3D"this.href=3D'javascript:';retur=
n true;">ne...@eviloverlord.com</a><wbr>> (847) 691-1404
</div></div>
</blockquote></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_298_1388804589.1414084907823--
.
Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Thu, 23 Oct 2014 20:24:41 +0300
Raw View
On 23 October 2014 20:21, <contact@ncomputers.org> wrote:
> Nevin, thank you very much for your answer.
>
>> But in good C++ code, 99% of local variables should be declared at the
>> point of first use.
>
>
> I agree partially with it. When writing a release version, I would declare
> variables at the point of first use. David's proposal could be useful for
> this. (Using objects as namespace)
>
> For example:
>
> template<typename P,typename E>
> class GC{
> struct variables{
> C*c0,*c1,*c2,**cc0,**cc1;
> H*h0,*h1,*h2,**hh0,**hh1,***hhh0;
> P e,p,a,*p0,*p1;
> V*v0,**vv0;
> }
>
> void function_1(){
> using variables as_namespace;
> }
> };
I don't know about others, but I'm completely at loss about what these examples
are meant to illustrate. I do not understand why you want to declare
the same local
variables in every member function of a class.
--
---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
.
Author: contact@ncomputers.org
Date: Thu, 23 Oct 2014 10:42:59 -0700 (PDT)
Raw View
------=_Part_833_1693554705.1414086179286
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Daniel,
Thank you very much for your questions.
I still think that there is no need to see anecdotic code.
The best way I had to answer your question, was showing you my code, so=20
that you can see how much they would impact it and even see, that they are=
=20
unnecessary for my code. I asked you for patience. Why should I answer your=
=20
question if you don't want to see the answer?
Anyway, I will answer it as you want.
why helper class or delegator pattern don't solve your issue.
I think, that you are supposing that I want to solve an issue. I'm here=20
because I'm making a suggestion for proposal.
Please explain why the helper class idiom or the delegator pattern=20
> don't solve the problem
There is no problem.
The answer is: No answer.
You asked me:
Why the helper class idiom or the delegator pattern don't solve the problem=
?
Delegator pattern or class idiom could help on some cases to solve=20
problems, seen from my point of view, on these cases there is no problem! I=
=20
can't relate the behaviour of delegator pattern and class helpers to the=20
behaviour of *nested namespaces*.
Best regards,
PF, ncomputers
Am Mittwoch, 22. Oktober 2014 23:59:00 UTC-5 schrieb dgutson:
>
> I still think that there is no need to see anecdotic code. Please answer=
=20
> my question from an analytical point of view: why helper class or delegat=
or=20
> pattern don't solve your issue.
> ------------------------------
> *From: * con...@ncomputers.org <javascript:>=20
> *Date: *Wed, 22 Oct 2014 10:55:42 -0700 (PDT)
> *To: *<std-pr...@isocpp.org <javascript:>>
> *ReplyTo: * std-pr...@isocpp.org <javascript:>=20
> *Cc: *<dib...@ieee.org <javascript:>>
> *Subject: *Re: [std-proposals] Nested namespaces by classes
>
> Thank you very much for your time and your answer!
>
> This is a symptom of bad design: too many local variables, moreover=20
>> repeated in a subset of methods.=20
>
>
> The local variables are required.
>
> To avoid the repetition, *nested namespaces* would be useful.
>
> This is a symptom of bad design: too many local variables, moreover=20
>> repeated in a subset of methods.=20
>> It's an indication that a delegation or helper class may be needed.=20
>> I don't see any need for a language extension, but a good design=20
>> practice.=20
>> Please explain why the helper class idiom or the delegator pattern=20
>> don't solve the problem I assume you are trying to solve. =20
>>
>
> I can understand, that because I haven't published the code yet, you can=
=20
> suppose that its design is bad. I invite you to be patient. I invite to=
=20
> wait me a few weeks.
>
> El mi=C3=A9rcoles, 22 de octubre de 2014 12:28:30 UTC-5, dgutson escribi=
=C3=B3:
>>
>> On Wed, Oct 22, 2014 at 1:34 PM, <con...@ncomputers.org> wrote:=20
>> > David,=20
>> >=20
>> > Thank you very much for your answer.=20
>> >=20
>> >> When providing a motivating example, I would go the extra mile and=20
>> provide=20
>> >> how this would look in the new design.=20
>> >=20
>> >=20
>> > Ok, this is how it would be:=20
>> >=20
>> > Without nested namespaces:=20
>> >=20
>> >=20
>> > template<typename P,typename E>=20
>> > class GC{=20
>> > void function_1(){=20
>> > C*c1,*c0,**cc0,**cc1;=20
>> > P e,p,*p0,*p1;=20
>> > V*v0;=20
>> > }=20
>>
>> This is a symptom of bad design: too many local variables, moreover=20
>> repeated in a subset of methods.=20
>> It's an indication that a delegation or helper class may be needed.=20
>> I don't see any need for a language extension, but a good design=20
>> practice.=20
>> Please explain why the helper class idiom or the delegator pattern=20
>> don't solve the problem I assume you are trying to solve.=20
>>
>> >=20
>> > void function_2(){=20
>> > C*c0,*c1,*c2,**cc0,**cc1;=20
>> > H*h0,*h1,**hh0;=20
>> > P e,p,*p0,*p1;=20
>> > V*v0;=20
>> > }=20
>> >=20
>> > void function_3(){=20
>> > C*c0,*c1,*c2;=20
>> > H*h0;=20
>> > H***hhh0;=20
>> > V*v0;=20
>> > P e,*p0,*p1;=20
>> > }=20
>> >=20
>> > void function_4(){=20
>> > C*c0,*c1;=20
>> > H**hh0;=20
>> > P e,p,*p0,*p1;=20
>> > V*v0;=20
>> > }=20
>> >=20
>> > void function_5(){=20
>> > C**cc0,**cc1;=20
>> > }=20
>> >=20
>> > void function_6(){=20
>> > H*h0,*h1,*h2;=20
>> > P p,e,a;=20
>> > P*p0;=20
>> > H**hh0;=20
>> > V**vv0;=20
>> > }=20
>> >=20
>> > void function_7(){=20
>> > C**cc0,**cc1;=20
>> > H**hh0,**hh1;=20
>> > }=20
>> > };=20
>> >=20
>> > With nested namespaces:=20
>> >=20
>> > template<typename P,typename E>=20
>> > class GC{=20
>> > namespace variables{=20
>> > C*c0,*c1,*c2,**cc0,**cc1;=20
>> > H*h0,*h1,*h2,**hh0,**hh1,***hhh0;=20
>> > P e,p,a,*p0,*p1;=20
>> > V*v0,**vv0;=20
>> > }=20
>> >=20
>> > void function_1(){=20
>> > using namespace variables;=20
>> > }=20
>> >=20
>> > void function_2(){=20
>> > using namespace variables;=20
>> > }=20
>> >=20
>> > void function_3(){=20
>> > using namespace variables;=20
>> > }=20
>> >=20
>> > void function_4(){=20
>> > using namespace variables;=20
>> > }=20
>> >=20
>> > void function_5(){=20
>> > using namespace variables;=20
>> > }=20
>> >=20
>> > void function_6(){=20
>> > using namespace variables;=20
>> > }=20
>> >=20
>> > void function_7(){=20
>> > using namespace variables;=20
>> > }=20
>> > };=20
>> >=20
>> > El mi=C3=A9rcoles, 22 de octubre de 2014 11:05:10 UTC-5, David Rodr=C3=
=ADguez=20
>> Ibeas=20
>> > escribi=C3=B3:=20
>> >>=20
>> >> When providing a motivating example, I would go the extra mile and=20
>> provide=20
>> >> how this would look in the new design.=20
>> >>=20
>> >> Other than that, the comments and examples lead me to think this is=
=20
>> really=20
>> >> a couple of conflicting things... In this last example, all of the=20
>> variables=20
>> >> are local to each function, while the modified design would make them=
=20
>> >> members of the class. This is an important change in the design, as i=
t=20
>> makes=20
>> >> that additional data persistent beyond the function call (additional=
=20
>> memory=20
>> >> requirements) and prone to side effects from other functions. If one=
=20
>> >> function above calls another and it does not pass pointers or=20
>> references to=20
>> >> its local variables it is clear both to the developer (understanding=
=20
>> of=20
>> >> code) and the compiler (optimizing code) that the variable is not=20
>> modified=20
>> >> externally. Once you move those local variables to the object, that i=
s=20
>> no=20
>> >> longer the case. Furthermore, it opens the door to subtle bugs where=
=20
>> during=20
>> >> maintenance the called function starts modifying part of the temporar=
y=20
>> state=20
>> >> and affects the behavior of the callee.=20
>> >>=20
>> >> Regarding lookup, and on the comments above that the use of nested=20
>> types=20
>> >> (they really need not be nested, but members of a struct type=20
>> anyways), if=20
>> >> the only issue is with the additional name of the member there could=
=20
>> be=20
>> >> other alternatives that are simpler to understand and less error=20
>> prone. For=20
>> >> example, and I am sure this has been proposed before, you could modif=
y=20
>> >> lookup to avoid the need of the name (from the example using 'struct=
=20
>> A' in a=20
>> >> previous message):=20
>> >>=20
>> >> void foo();=20
>> >> struct A {=20
>> >> struct Nested { int Signed; unsigned Unsigned; } o_nested;=20
>> >> int x;=20
>> >> A() {=20
>> >> using o_nested {=20
>> >> Unsigned =3D 5;=20
>> >> x =3D -1;=20
>> >> foo();=20
>> >> }=20
>> >> }=20
>> >> };=20
>> >>=20
>> >> Where the 'using' above would affect unqualified lookup by forcing th=
e=20
>> >> lookup of the name to first check as a member of 'o_nested' (in the=
=20
>> same way=20
>> >> that 'this' is checked for unqualified lookup inside a member) for=20
>> >> 'Unsigned', if that is not found it would move up to the class scope=
=20
>> as for=20
>> >> 'x' or move further out according to the existing lookup rules.=20
>> >>=20
>> >> I don't find Michael's example of 'tetris_t' particularly compelling,=
=20
>> >> since it seems to be throwing a bunch of unrelated functionality into=
=20
>> a=20
>> >> single class and using prefixes to separate behavior. I consider that=
=20
>> a bad=20
>> >> design and I'd argue that modifying the language to simplify bad=20
>> designs is=20
>> >> not really a good goal. If anything, bad designs should be *harder*,=
=20
>> not=20
>> >> *simpler* to implement.=20
>> >>=20
>> >> Summarizing: If the goal is to substitute packs of local variables=20
>> that=20
>> >> are commonly aggregated in functions, this is a horrible solution.=20
>> Create a=20
>> >> type and have a local instance of the type. If the goal is to separat=
e=20
>> >> concerns and group related *members*, then using a type and a member=
=20
>> of the=20
>> >> type seem like a more reasonable solution, if the burden of typing th=
e=20
>> >> member name is deemed big, a small modification to look up *in the=20
>> scope of=20
>> >> the code that uses it* seems like a narrower and simpler change.=20
>> >>=20
>> >> David=20
>> >>=20
>> >> On Wed, Oct 22, 2014 at 12:52 AM, <con...@ncomputers.org> wrote:=20
>> >>>=20
>> >>> Jens,=20
>> >>>=20
>> >>> I've found how to give you a better example.=20
>> >>>=20
>> >>> I will only copy the declaration of the variables of my code. (Graph=
=20
>> >>> Coloring.cpp)=20
>> >>>=20
>> >>>> A key property to prototyping is the fact that it is supposed to be=
=20
>> done=20
>> >>>> quickly.=20
>> >>>=20
>> >>>=20
>> >>> I have been working on this code for more than three months. I make =
a=20
>> >>> prototype, I change it, make a new, change it again, and so on. It=
=20
>> would=20
>> >>> help me a lot to have nested namespaces. Instead of declaring all=20
>> variables=20
>> >>> inside each function, I would declare it inside a nested namespace=
=20
>> (to avoid=20
>> >>> confusions if they were direct members of the object) and when I hav=
e=20
>> a=20
>> >>> final prototype, refactor the code.=20
>> >>>=20
>> >>> (These are segments of functions (that run at different runtimes) of=
=20
>> a=20
>> >>> real code with a real application):=20
>> >>>=20
>> >>> template<typename P,typename E>=20
>> >>> class GC{=20
>> >>> void function_1(){=20
>> >>> C*c1,*c0,**cc0,**cc1;=20
>> >>> P e,p,*p0,*p1;=20
>> >>> V*v0;=20
>> >>> }=20
>> >>>=20
>> >>> void function_2(){=20
>> >>> C*c0,*c1,*c2,**cc0,**cc1;=20
>> >>> H*h0,*h1,**hh0;=20
>> >>> P e,p,*p0,*p1;=20
>> >>> V*v0;=20
>> >>> }=20
>> >>>=20
>> >>> void function_3(){=20
>> >>> C*c0,*c1,*c2;=20
>> >>> H*h0;=20
>> >>> H***hhh0;=20
>> >>> V*v0;=20
>> >>> P e,*p0,*p1;=20
>> >>> }=20
>> >>>=20
>> >>> void function_4(){=20
>> >>> C*c0,*c1;=20
>> >>> H**hh0;=20
>> >>> P e,p,*p0,*p1;=20
>> >>> V*v0;=20
>> >>> }=20
>> >>>=20
>> >>> void function_5(){=20
>> >>> C**cc0,**cc1;=20
>> >>> }=20
>> >>>=20
>> >>> void function_6(){=20
>> >>> H*h0,*h1,*h2;=20
>> >>> P p,e,a;=20
>> >>> P*p0;=20
>> >>> H**hh0;=20
>> >>> V**vv0;=20
>> >>> }=20
>> >>>=20
>> >>> void function_7(){=20
>> >>> C**cc0,**cc1;=20
>> >>> H**hh0,**hh1;=20
>> >>> }=20
>> >>> };=20
>> >>>=20
>> >>> Reference: http://en.wikipedia.org/wiki/Software_prototyping=20
>> >>>=20
>> >>> El martes, 21 de octubre de 2014 13:23:14 UTC-5, Jens Maurer=20
>> escribi=C3=B3:=20
>> >>>>=20
>> >>>> On 10/21/2014 07:47 PM, con...@ncomputers.org wrote:=20
>> >>>> > void vertices(){=20
>> >>>> > P*p0,*p1;=20
>> >>>> > //Variables=20
>> >>>> > cout<<this->rn<<" vertices with edges:";=20
>> >>>> >=20
>> >>>> > for(p0=3Dthis->ra,p1=3Dthis->rz;p0<p1;)cout<<*p0++<<',';cout<<end=
l;=20
>> >>>> > cout<<this->in<<" vertices without edges:";=20
>> >>>> >=20
>> >>>> > for(p0=3Dthis->ia,p1=3Dthis->iz;p0<p1;)cout<<*--p1<<',';cout<<end=
l;=20
>> >>>>=20
>> >>>> I'd recommend investing in a space key. This is unreadable.=20
>> >>>>=20
>> >>>> Thanks,=20
>> >>>> Jens=20
>> >>>>=20
>> >>> --=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,=20
>> send an=20
>> >>> email to std-proposal...@isocpp.org.=20
>> >>> To post to this group, send email to std-pr...@isocpp.org.=20
>> >>> Visit this group at=20
>> >>> http://groups.google.com/a/isocpp.org/group/std-proposals/.=20
>> >>=20
>> >>=20
>> > --=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.=20
>> > To post to this group, send email to std-pr...@isocpp.org.=20
>> > Visit this group at=20
>> > http://groups.google.com/a/isocpp.org/group/std-proposals/.=20
>>
>>
>>
>> --=20
>> Who=E2=80=99s got the sweetest disposition?=20
>> One guess, that=E2=80=99s who?=20
>> Who=E2=80=99d never, ever start an argument?=20
>> Who never shows a bit of temperament?=20
>> Who's never wrong but always right?=20
>> Who'd never dream of starting a fight?=20
>> Who get stuck with all the bad luck?=20
>>
> --=20
>
> ---=20
> You received this message because you are subscribed to the Google Groups=
=20
> "ISO C++ Standard - Future Proposals" group.
> To unsubscribe from this group and stop receiving emails from it, send an=
=20
> email to std-proposal...@isocpp.org <javascript:>.
> To post to this group, send email to std-pr...@isocpp.org <javascript:>.
> Visit this group at=20
> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>
--=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
------=_Part_833_1693554705.1414086179286
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Daniel,<br><br>Thank you very much for your questions.<br>=
<br><blockquote style=3D"margin: 0px 0px 0px 0.8ex; border-left: 1px solid =
rgb(204, 204, 204); padding-left: 1ex;" class=3D"gmail_quote">I still think=
that there is no need to see anecdotic code.</blockquote><div><br>The best=
way I had to answer your question, was showing you my code, so that you ca=
n see how much they would impact it and even see, that they are unnecessary=
for my code. I asked you for patience. Why should I answer your question i=
f you don't want to see the answer?<br><br>Anyway, I will answer it as you =
want.<br><br><blockquote style=3D"margin: 0px 0px 0px 0.8ex; border-left: 1=
px solid rgb(204, 204, 204); padding-left: 1ex;" class=3D"gmail_quote">why =
helper class or delegator pattern don't solve your issue.</blockquote><div>=
<br>I think, that you are supposing that I want to solve an issue. I'm here=
because I'm making a suggestion for proposal.<br><br><blockquote style=3D"=
margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); paddi=
ng-left: 1ex;" class=3D"gmail_quote">Please explain why the helper class id=
iom or the delegator pattern
<br>don't solve the problem</blockquote><div><br>There is no problem.<br><b=
r>The answer is: No answer.<br><br>You asked me:<br><br><blockquote style=
=3D"margin: 0px 0px 0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); p=
adding-left: 1ex;" class=3D"gmail_quote">Why the helper class idiom or the =
delegator pattern don't solve the problem?</blockquote><div><br>Delegator p=
attern or class idiom could help on some cases to solve problems, seen from=
my point of view, on these cases there is no problem! I can't relate the b=
ehaviour of delegator pattern and class helpers to the behaviour of <b>nest=
ed namespaces</b>.<br><br>Best regards,<br><br>PF, ncomputers<br> </div></d=
iv></div></div><br>Am Mittwoch, 22. Oktober 2014 23:59:00 UTC-5 schrieb dgu=
tson:<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8e=
x;border-left: 1px #ccc solid;padding-left: 1ex;"><div>I still think that t=
here is no need to see anecdotic code. Please answer my question from an an=
alytical point of view: why helper class or delegator pattern don't solve y=
our issue.<hr><div><b>From: </b> <a href=3D"javascript:" target=3D"_blank" =
gdf-obfuscated-mailto=3D"InbFUQ5UDwIJ" onmousedown=3D"this.href=3D'javascri=
pt:';return true;" onclick=3D"this.href=3D'javascript:';return true;">con..=
..@ncomputers.org</a>
</div><div><b>Date: </b>Wed, 22 Oct 2014 10:55:42 -0700 (PDT)</div><div><b>=
To: </b><<a href=3D"javascript:" target=3D"_blank" gdf-obfuscated-mailto=
=3D"InbFUQ5UDwIJ" onmousedown=3D"this.href=3D'javascript:';return true;" on=
click=3D"this.href=3D'javascript:';return true;">std-pr...@isocpp.org</a>&g=
t;</div><div><b>ReplyTo: </b> <a href=3D"javascript:" target=3D"_blank" gdf=
-obfuscated-mailto=3D"InbFUQ5UDwIJ" onmousedown=3D"this.href=3D'javascript:=
';return true;" onclick=3D"this.href=3D'javascript:';return true;">std-pr..=
..@isocpp.org</a>
</div><div><b>Cc: </b><<a href=3D"javascript:" target=3D"_blank" gdf-obf=
uscated-mailto=3D"InbFUQ5UDwIJ" onmousedown=3D"this.href=3D'javascript:';re=
turn true;" onclick=3D"this.href=3D'javascript:';return true;">dib...@ieee.=
org</a>></div><div><b>Subject: </b>Re: [std-proposals] Nested namespaces=
by classes</div><div><br></div><div dir=3D"ltr">Thank you very much for yo=
ur time and your answer!<br><br><blockquote style=3D"margin:0px 0px 0px 0.8=
ex;border-left:1px solid rgb(204,204,204);padding-left:1ex" class=3D"gmail_=
quote">This is a symptom of bad design: too many local variables, moreover
<br>repeated in a subset of methods.
</blockquote><div><br>The local variables are required.<br><br>To avoid the=
repetition, <b>nested namespaces</b> would be useful.<br><br><blockquote s=
tyle=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);pad=
ding-left:1ex" class=3D"gmail_quote">This is a symptom of bad design: too m=
any local variables, moreover
<br>repeated in a subset of methods.
<br>It's an indication that a delegation or helper class may be needed.
<br>I don't see any need for a language extension, but a good design practi=
ce.
<br>Please explain why the helper class idiom or the delegator pattern
<br>don't solve the problem I assume you are trying to solve.
<br></blockquote><div><br>I can understand, that because I haven't pu=
blished the code yet, you can suppose that its design is bad. I invite you =
to be patient. I invite to wait me a few weeks.<br></div></div><br>El mi=C3=
=A9rcoles, 22 de octubre de 2014 12:28:30 UTC-5, dgutson escribi=C3=B3:<blo=
ckquote class=3D"gmail_quote" style=3D"margin:0;margin-left:0.8ex;border-le=
ft:1px #ccc solid;padding-left:1ex">On Wed, Oct 22, 2014 at 1:34 PM, =
<<a>con...@ncomputers.org</a>> wrote:
<br>> David,
<br>>
<br>> Thank you very much for your answer.
<br>>
<br>>> When providing a motivating example, I would go the extra mile=
and provide
<br>>> how this would look in the new design.
<br>>
<br>>
<br>> Ok, this is how it would be:
<br>>
<br>> Without nested namespaces:
<br>>
<br>>
<br>> template<typename P,typename E>
<br>> class GC{
<br>> void function_1(){
<br>> C*c1,*c0,**cc0,**cc1;
<br>> P e,p,*p0,*p1;
<br>> V*v0;
<br>> }
<br>
<br>This is a symptom of bad design: too many local variables, moreover
<br>repeated in a subset of methods.
<br>It's an indication that a delegation or helper class may be needed.
<br>I don't see any need for a language extension, but a good design practi=
ce.
<br>Please explain why the helper class idiom or the delegator pattern
<br>don't solve the problem I assume you are trying to solve.
<br>
<br>>
<br>> void function_2(){
<br>> C*c0,*c1,*c2,**cc0,**cc1;
<br>> H*h0,*h1,**hh0;
<br>> P e,p,*p0,*p1;
<br>> V*v0;
<br>> }
<br>>
<br>> void function_3(){
<br>> C*c0,*c1,*c2;
<br>> H*h0;
<br>> H***hhh0;
<br>> V*v0;
<br>> P e,*p0,*p1;
<br>> }
<br>>
<br>> void function_4(){
<br>> C*c0,*c1;
<br>> H**hh0;
<br>> P e,p,*p0,*p1;
<br>> V*v0;
<br>> }
<br>>
<br>> void function_5(){
<br>> C**cc0,**cc1;
<br>> }
<br>>
<br>> void function_6(){
<br>> H*h0,*h1,*h2;
<br>> P p,e,a;
<br>> P*p0;
<br>> H**hh0;
<br>> V**vv0;
<br>> }
<br>>
<br>> void function_7(){
<br>> C**cc0,**cc1;
<br>> H**hh0,**hh1;
<br>> }
<br>> };
<br>>
<br>> With nested namespaces:
<br>>
<br>> template<typename P,typename E>
<br>> class GC{
<br>> namespace variables{
<br>> C*c0,*c1,*c2,**cc0,**cc1;
<br>> H*h0,*h1,*h2,**hh0,**hh1,***<wbr>hhh0;
<br>> P e,p,a,*p0,*p1;
<br>> V*v0,**vv0;
<br>> }
<br>>
<br>> void function_1(){
<br>> using namespace variables;
<br>> }
<br>>
<br>> void function_2(){
<br>> using namespace variables;
<br>> }
<br>>
<br>> void function_3(){
<br>> using namespace variables;
<br>> }
<br>>
<br>> void function_4(){
<br>> using namespace variables;
<br>> }
<br>>
<br>> void function_5(){
<br>> using namespace variables;
<br>> }
<br>>
<br>> void function_6(){
<br>> using namespace variables;
<br>> }
<br>>
<br>> void function_7(){
<br>> using namespace variables;
<br>> }
<br>> };
<br>>
<br>> El mi=C3=A9rcoles, 22 de octubre de 2014 11:05:10 UTC-5, David Rod=
r=C3=ADguez Ibeas
<br>> escribi=C3=B3:
<br>>>
<br>>> When providing a motivating example, I would go the extra mile=
and provide
<br>>> how this would look in the new design.
<br>>>
<br>>> Other than that, the comments and examples lead me to think th=
is is really
<br>>> a couple of conflicting things... In this last example, all of=
the variables
<br>>> are local to each function, while the modified design would ma=
ke them
<br>>> members of the class. This is an important change in the desig=
n, as it makes
<br>>> that additional data persistent beyond the function call (addi=
tional memory
<br>>> requirements) and prone to side effects from other functions. =
If one
<br>>> function above calls another and it does not pass pointers or =
references to
<br>>> its local variables it is clear both to the developer (underst=
anding of
<br>>> code) and the compiler (optimizing code) that the variable is =
not modified
<br>>> externally. Once you move those local variables to the object,=
that is no
<br>>> longer the case. Furthermore, it opens the door to subtle bugs=
where during
<br>>> maintenance the called function starts modifying part of the t=
emporary state
<br>>> and affects the behavior of the callee.
<br>>>
<br>>> Regarding lookup, and on the comments above that the use of ne=
sted types
<br>>> (they really need not be nested, but members of a struct type =
anyways), if
<br>>> the only issue is with the additional name of the member there=
could be
<br>>> other alternatives that are simpler to understand and less err=
or prone. For
<br>>> example, and I am sure this has been proposed before, you coul=
d modify
<br>>> lookup to avoid the need of the name (from the example using '=
struct A' in a
<br>>> previous message):
<br>>>
<br>>> void foo();
<br>>> struct A {
<br>>> struct Nested { int Signed; unsigned Unsig=
ned; } o_nested;
<br>>> int x;
<br>>> A() {
<br>>> using o_nested {
<br>>> Unsigned =3D =
5;
<br>>> x =3D -1;
<br>>> foo();
<br>>> }
<br>>> }
<br>>> };
<br>>>
<br>>> Where the 'using' above would affect unqualified lookup by for=
cing the
<br>>> lookup of the name to first check as a member of 'o_nested' (i=
n the same way
<br>>> that 'this' is checked for unqualified lookup inside a member)=
for
<br>>> 'Unsigned', if that is not found it would move up to the class=
scope as for
<br>>> 'x' or move further out according to the existing lookup rules=
..
<br>>>
<br>>> I don't find Michael's example of 'tetris_t' particularly comp=
elling,
<br>>> since it seems to be throwing a bunch of unrelated functionali=
ty into a
<br>>> single class and using prefixes to separate behavior. I consid=
er that a bad
<br>>> design and I'd argue that modifying the language to simplify b=
ad designs is
<br>>> not really a good goal. If anything, bad designs should be *ha=
rder*, not
<br>>> *simpler* to implement.
<br>>>
<br>>> Summarizing: If the goal is to substitute packs of local varia=
bles that
<br>>> are commonly aggregated in functions, this is a horrible solut=
ion. Create a
<br>>> type and have a local instance of the type. If the goal is to =
separate
<br>>> concerns and group related *members*, then using a type and a =
member of the
<br>>> type seem like a more reasonable solution, if the burden of ty=
ping the
<br>>> member name is deemed big, a small modification to look up *in=
the scope of
<br>>> the code that uses it* seems like a narrower and simpler chang=
e.
<br>>>
<br>>> David
<br>>>
<br>>> On Wed, Oct 22, 2014 at 12:52 AM, <<a>con...@ncomputers.org=
</a>> wrote:
<br>>>>
<br>>>> Jens,
<br>>>>
<br>>>> I've found how to give you a better example.
<br>>>>
<br>>>> I will only copy the declaration of the variables of my co=
de. (Graph
<br>>>> Coloring.cpp)
<br>>>>
<br>>>>> A key property to prototyping is the fact that it is s=
upposed to be done
<br>>>>> quickly.
<br>>>>
<br>>>>
<br>>>> I have been working on this code for more than three month=
s. I make a
<br>>>> prototype, I change it, make a new, change it again, and s=
o on. It would
<br>>>> help me a lot to have nested namespaces. Instead of declar=
ing all variables
<br>>>> inside each function, I would declare it inside a nested n=
amespace (to avoid
<br>>>> confusions if they were direct members of the object) and =
when I have a
<br>>>> final prototype, refactor the code.
<br>>>>
<br>>>> (These are segments of functions (that run at different ru=
ntimes) of a
<br>>>> real code with a real application):
<br>>>>
<br>>>> template<typename P,typename E>
<br>>>> class GC{
<br>>>> void function_1(){
<br>>>> C*c1,*c0,**cc0,**cc1;
<br>>>> P e,p,*p0,*p1;
<br>>>> V*v0;
<br>>>> }
<br>>>>
<br>>>> void function_2(){
<br>>>> C*c0,*c1,*c2,**cc0,**cc1;
<br>>>> H*h0,*h1,**hh0;
<br>>>> P e,p,*p0,*p1;
<br>>>> V*v0;
<br>>>> }
<br>>>>
<br>>>> void function_3(){
<br>>>> C*c0,*c1,*c2;
<br>>>> H*h0;
<br>>>> H***hhh0;
<br>>>> V*v0;
<br>>>> P e,*p0,*p1;
<br>>>> }
<br>>>>
<br>>>> void function_4(){
<br>>>> C*c0,*c1;
<br>>>> H**hh0;
<br>>>> P e,p,*p0,*p1;
<br>>>> V*v0;
<br>>>> }
<br>>>>
<br>>>> void function_5(){
<br>>>> C**cc0,**cc1;
<br>>>> }
<br>>>>
<br>>>> void function_6(){
<br>>>> H*h0,*h1,*h2;
<br>>>> P p,e,a;
<br>>>> P*p0;
<br>>>> H**hh0;
<br>>>> V**vv0;
<br>>>> }
<br>>>>
<br>>>> void function_7(){
<br>>>> C**cc0,**cc1;
<br>>>> H**hh0,**hh1;
<br>>>> }
<br>>>> };
<br>>>>
<br>>>> Reference: <a href=3D"http://en.wikipedia.org/wiki/Softwar=
e_prototyping" target=3D"_blank" onmousedown=3D"this.href=3D'http://www.goo=
gle.com/url?q\75http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FSoftware_prototyping=
\46sa\75D\46sntz\0751\46usg\75AFQjCNF0oTeXY9CCp0DlQkC9b9DYI0jdwA';return tr=
ue;" onclick=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fen.=
wikipedia.org%2Fwiki%2FSoftware_prototyping\46sa\75D\46sntz\0751\46usg\75AF=
QjCNF0oTeXY9CCp0DlQkC9b9DYI0jdwA';return true;">http://en.wikipedia.org/wik=
i/<wbr>Software_prototyping</a>
<br>>>>
<br>>>> El martes, 21 de octubre de 2014 13:23:14 UTC-5, Jens Maur=
er escribi=C3=B3:
<br>>>>>
<br>>>>> On 10/21/2014 07:47 PM, <a>con...@ncomputers.org</a> w=
rote:
<br>>>>> > void vertices(){
<br>>>>> > P*p0,*p1;
<br>>>>> > //Variables
<br>>>>> > cout<<this->=
rn<<" vertices with edges:";
<br>>>>> >
<br>>>>> > for(p0=3Dthis->ra,p1=3Dthis->rz;<wbr>p0<=
p1;)cout<<*p0++<<',';cout<<<wbr>endl;
<br>>>>> > cout<<this->=
in<<" vertices without edges:";
<br>>>>> >
<br>>>>> > for(p0=3Dthis->ia,p1=3Dthis->iz;<wbr>p0<=
p1;)cout<<*--p1<<',';cout<<<wbr>endl;
<br>>>>>
<br>>>>> I'd recommend investing in a space key. This is =
unreadable.
<br>>>>>
<br>>>>> Thanks,
<br>>>>> Jens
<br>>>>>
<br>>>> --
<br>>>>
<br>>>> ---
<br>>>> You received this message because you are subscribed to th=
e Google Groups
<br>>>> "ISO C++ Standard - Future Proposals" group.
<br>>>> To unsubscribe from this group and stop receiving emails f=
rom it, send an
<br>>>> email to <a>std-proposal...@isocpp.org</a>.
<br>>>> To post to this group, send email to <a>std-pr...@isocpp.o=
rg</a>.
<br>>>> Visit this group at
<br>>>> <a href=3D"http://groups.google.com/a/isocpp.org/group/std=
-proposals/" target=3D"_blank" onmousedown=3D"this.href=3D'http://groups.go=
ogle.com/a/isocpp.org/group/std-proposals/';return true;" onclick=3D"this.h=
ref=3D'http://groups.google.com/a/isocpp.org/group/std-proposals/';return t=
rue;">http://groups.google.com/a/<wbr>isocpp.org/group/std-<wbr>proposals/<=
/a>.
<br>>>
<br>>>
<br>> --
<br>>
<br>> ---
<br>> You received this message because you are subscribed to the Google=
Groups
<br>> "ISO C++ Standard - Future Proposals" group.
<br>> To unsubscribe from this group and stop receiving emails from it, =
send an
<br>> email to <a>std-proposal...@isocpp.org</a>.
<br>> To post to this group, send email to <a>std-pr...@isocpp.org</a>.
<br>> Visit this group at
<br>> <a href=3D"http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/" target=3D"_blank" onmousedown=3D"this.href=3D'http://groups.google.com=
/a/isocpp.org/group/std-proposals/';return true;" onclick=3D"this.href=3D'h=
ttp://groups.google.com/a/isocpp.org/group/std-proposals/';return true;">ht=
tp://groups.google.com/a/<wbr>isocpp.org/group/std-<wbr>proposals/</a>.
<br>
<br>
<br>
<br>--=20
<br>Who=E2=80=99s got the sweetest disposition?
<br>One guess, that=E2=80=99s who?
<br>Who=E2=80=99d never, ever start an argument?
<br>Who never shows a bit of temperament?
<br>Who's never wrong but always right?
<br>Who'd never dream of starting a fight?
<br>Who get stuck with all the bad luck?
<br></blockquote></div>
<p></p>
-- <br>
<br>
--- <br>
You received this message because you are subscribed to the Google Groups "=
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"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"=
InbFUQ5UDwIJ" onmousedown=3D"this.href=3D'javascript:';return true;" onclic=
k=3D"this.href=3D'javascript:';return true;">std-proposal...@<wbr>isocpp.or=
g</a>.<br>
To post to this group, send email to <a href=3D"javascript:" target=3D"_bla=
nk" gdf-obfuscated-mailto=3D"InbFUQ5UDwIJ" onmousedown=3D"this.href=3D'java=
script:';return true;" onclick=3D"this.href=3D'javascript:';return true;">s=
td-pr...@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank" onmousedown=3D"this.href=3D'http://groups=
..google.com/a/isocpp.org/group/std-proposals/';return true;" onclick=3D"thi=
s.href=3D'http://groups.google.com/a/isocpp.org/group/std-proposals/';retur=
n true;">http://groups.google.com/a/<wbr>isocpp.org/group/std-<wbr>proposal=
s/</a>.<br>
</div></blockquote></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_833_1693554705.1414086179286--
.
Author: contact@ncomputers.org
Date: Thu, 23 Oct 2014 11:08:40 -0700 (PDT)
Raw View
------=_Part_866_1940567141.1414087720066
Content-Type: text/plain; charset=UTF-8
Ville,
Thank you very much for your comments!
Ok, I'll try to explain it better and take your comment into account.
This is an example of a real code. It has some functions that use almost
the same variables to compute the data. It is taken from (Graph
Coloring.cpp)
All functions run at different runtimes. I'm using evolutionary prototyping
to write it and it requires to change it all the time.
template<typename P,typename E>
class GC{
void function_1(){
C*c1,*c0,**cc0,**cc1;
P e,p,*p0,*p1;
V*v0;
}
void function_2(){
C*c0,*c1,*c2,**cc0,**cc1;
H*h0,*h1,**hh0;
P e,p,*p0,*p1;
V*v0;
}
void function_3(){
C*c0,*c1,*c2;
H*h0;
H***hhh0;
V*v0;
P e,*p0,*p1;
}
void function_4(){
C*c0,*c1;
H**hh0;
P e,p,*p0,*p1;
V*v0;
}
void function_5(){
C**cc0,**cc1;
}
void function_6(){
H*h0,*h1,*h2;
P p,e,a;
P*p0;
H**hh0;
V**vv0;
}
void function_7(){
C**cc0,**cc1;
H**hh0,**hh1;
}
};
For example, It is possible that I'll write today a new function, that runs
at different runtime and requires some of the above variables.
(I usually ignore which variables will it exactly require until I've
written the code),
It would be very useful for me to have a nested namespace with the
declaration of all variables, letting me forget the need to declare the
variables inside each new function, what could reduce the required time to
imrpove my prototype, for example:
template<typename P,typename E>
class GC{
namespace variables{
C*c0,*c1,*c2,**cc0,**cc1;
H*h0,*h1,*h2,**hh0,**hh1,***hhh0;
P e,p,a,*p0,*p1;
V*v0,**vv0;
}
void function_1(){
using namespace variables;
//See variables of the namespace
for(p=0;p<10;++p){}
c0=c1;
}
void function_2(){
using namespace variables;
}
void function_3(){
using namespace variables;
}
void function_4(){
using namespace variables;
}
void function_5(){
using namespace variables;
}
void function_6(){
using namespace variables;
}
void function_7(){
using namespace variables;
}
};
These variables would have the same lifetime of the objects lifetime. This
is really irrelevant for me, but for those cases, where it is relevant, I
suggest David's idea:
template<typename P,typename E>
class GC{
struct variables{
C*c0,*c1,*c2,**cc0,**cc1;
H*h0,*h1,*h2,**hh0,**hh1,***hhh0;
P e,p,a,*p0,*p1;
V*v0,**vv0;
}
void function_1(){
using variables as_namespace;
//See variables of the object
for(p=0;p<10;++p){}
c0=c1;
}
};
It would create an entire object of type variables called as_namespace
whose lifetime would depend on " } " character and the word using would
allow to see its variables without the need to write:
as_namespace.c0;
as_namespace.c1;
as_namespace.p;
When the final prototype is reached, I would copy and paste the namespace
content into each function and run a script that removes all the unused
variables, this with the intention of making it more maintainable.
PF, ncomputers
Am Donnerstag, 23. Oktober 2014 12:24:43 UTC-5 schrieb Ville Voutilainen:
>
> On 23 October 2014 20:21, <con...@ncomputers.org <javascript:>> wrote:
> > Nevin, thank you very much for your answer.
> >
> >> But in good C++ code, 99% of local variables should be declared at the
> >> point of first use.
> >
> >
> > I agree partially with it. When writing a release version, I would
> declare
> > variables at the point of first use. David's proposal could be useful
> for
> > this. (Using objects as namespace)
> >
> > For example:
> >
> > template<typename P,typename E>
> > class GC{
> > struct variables{
> > C*c0,*c1,*c2,**cc0,**cc1;
> > H*h0,*h1,*h2,**hh0,**hh1,***hhh0;
> > P e,p,a,*p0,*p1;
> > V*v0,**vv0;
> > }
> >
> > void function_1(){
> > using variables as_namespace;
> > }
> > };
>
>
> I don't know about others, but I'm completely at loss about what these
> examples
> are meant to illustrate. I do not understand why you want to declare
> the same local
> variables in every member function of a class.
>
--
---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_866_1940567141.1414087720066
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Ville,<br><br>Thank you very much for your comments!<br><b=
r>Ok, I'll try to explain it better and take your comment into account.<br>=
<br>This is an example of a real code. It has some functions that use almos=
t the same variables to compute the data. It is taken from (Graph Coloring.=
cpp)<br><br>All functions run at different runtimes. I'm using evolutionary=
prototyping to write it and it requires to change it all the time.<br><br>=
<div class=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); b=
order-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; wo=
rd-wrap: break-word;"><code class=3D"prettyprint"><div class=3D"subprettypr=
int"><div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,1=
87,187);border-style:solid;border-width:1px;word-wrap:break-word"><code><di=
v><span style=3D"color:#008"><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">template</span></span><span style=3D"color:#660"><span style=3D=
"color: #660;" class=3D"styled-by-prettify"><</span></span><span style=
=3D"color:#008"><span style=3D"color: #008;" class=3D"styled-by-prettify">t=
ypename</span></span><span style=3D"color:#000"><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> P</span></span><span style=3D"color:#660"><=
span style=3D"color: #660;" class=3D"styled-by-prettify">,</span></span><sp=
an style=3D"color:#008"><span style=3D"color: #008;" class=3D"styled-by-pre=
ttify">typename</span></span><span style=3D"color:#000"><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> E</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"st=
yled-by-prettify"><br></span></span><span style=3D"color:#008"><span style=
=3D"color: #008;" class=3D"styled-by-prettify">class</span></span><span sty=
le=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> GC</span></span><span style=3D"color:#660"><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">{</span></span><span style=3D"color:#000"><span=
style=3D"color: #000;" class=3D"styled-by-prettify"><br> </sp=
an></span><span style=3D"color:#008"><span style=3D"color: #008;" class=3D"=
styled-by-prettify">void</span></span><span style=3D"color:#000"><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> function_1</span></span><s=
pan style=3D"color:#660"><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">(){</span></span><span style=3D"color:#000"><span style=3D"color: #=
000;" class=3D"styled-by-prettify"><br> C</span>=
</span><span style=3D"color:#660"><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">*</span></span><span style=3D"color:#000"><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify">c1</span></span><span style=3D"co=
lor:#660"><span style=3D"color: #660;" class=3D"styled-by-prettify">,*</spa=
n></span><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify">c0</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">c=
c0</span></span><span style=3D"color:#660"><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">,**</span></span><span style=3D"color:#000"><span=
style=3D"color: #000;" class=3D"styled-by-prettify">cc1</span></span><span=
style=3D"color:#660"><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">;</span></span><span style=3D"color:#000"><span style=3D"color: #000;"=
class=3D"styled-by-prettify"><br> P e</span></s=
pan><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"colo=
r: #000;" class=3D"styled-by-prettify">p</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"style=
d-by-prettify">p0</span></span><span style=3D"color:#660"><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">,*</span></span><span style=3D"col=
or:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify">p1</span=
></span><span style=3D"color:#660"><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">;</span></span><span style=3D"color:#000"><span style=3D"=
color: #000;" class=3D"styled-by-prettify"><br> =
V</span></span><span style=3D"color:#660"><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">*</span></span><span style=3D"color:#000"><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify">v0</span></span><span sty=
le=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;" cla=
ss=3D"styled-by-prettify"><br> </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> <br> </span></span><span s=
tyle=3D"color:#008"><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">void</span></span><span style=3D"color:#000"><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> function_2</span></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 style=3D"color: #000;" class=3D"st=
yled-by-prettify"><br> C</span></span><span styl=
e=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;" clas=
s=3D"styled-by-prettify">c0</span></span><span style=3D"color:#660"><span s=
tyle=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=
">c1</span></span><span style=3D"color:#660"><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">,*</span></span><span style=3D"color:#000"><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify">c2</span></span><span=
style=3D"color:#660"><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">,**</span></span><span style=3D"color:#000"><span style=3D"color: #000=
;" class=3D"styled-by-prettify">cc0</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">cc1</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> &=
nbsp; H</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">h=
0</span></span><span style=3D"color:#660"><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">,*</span></span><span style=3D"color:#000"><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify">h1</span></span><span st=
yle=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">hh0</span></span><span style=3D"color:#660"><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">;</span></span><spa=
n style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"><br> P e</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"style=
d-by-prettify">p</span></span><span style=3D"color:#660"><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">,*</span></span><span style=3D"colo=
r:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify">p0</span>=
</span><span style=3D"color:#660"><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">,*</span></span><span style=3D"color:#000"><span style=3D"=
color: #000;" class=3D"styled-by-prettify">p1</span></span><span style=3D"c=
olor:#660"><span style=3D"color: #660;" class=3D"styled-by-prettify">;</spa=
n></span><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"><br> V</span></span><span sty=
le=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;" cla=
ss=3D"styled-by-prettify">v0</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> </span></span><span style=3D"color:#660"><span style=3D=
"color: #660;" class=3D"styled-by-prettify">}</span></span><span style=3D"c=
olor:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&n=
bsp; <br> </span></span><span style=3D"color:#008"><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">void</span></span><sp=
an style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> function_3</span></span><span style=3D"color:#660"><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">(){</span></span><span style=3D"c=
olor:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&n=
bsp; C</span></span><span style=3D"color:#660"><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">*</span></span><span sty=
le=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify"=
>c0</span></span><span style=3D"color:#660"><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">,*</span></span><span style=3D"color:#000"><span=
style=3D"color: #000;" class=3D"styled-by-prettify">c1</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 style=3D"color: #000;"=
class=3D"styled-by-prettify">c2</span></span><span style=3D"color:#660"><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">;</span></span><spa=
n style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"><br> H</span></span><span style=3D"color:#=
660"><span style=3D"color: #660;" class=3D"styled-by-prettify">*</span></sp=
an><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-=
by-prettify">h0</span></span><span style=3D"color:#660"><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">;</span></span><span style=3D"color:=
#000"><span style=3D"color: #000;" class=3D"styled-by-prettify"><br> =
H</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">h=
hh0</span></span><span style=3D"color:#660"><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">;</span></span><span style=3D"color:#000"><span =
style=3D"color: #000;" class=3D"styled-by-prettify"><br>  =
; V</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">v0</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> P e</spa=
n></span><span style=3D"color:#660"><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">,*</span></span><span style=3D"color:#000"><span style=
=3D"color: #000;" class=3D"styled-by-prettify">p0</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;" clas=
s=3D"styled-by-prettify">p1</span></span><span style=3D"color:#660"><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">;</span></span><span sty=
le=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"co=
lor:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nb=
sp; <br> </span></span><span style=3D"color:#008"><span=
style=3D"color: #008;" class=3D"styled-by-prettify">void</span></span><spa=
n style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> function_4</span></span><span style=3D"color:#660"><span style=3D"co=
lor: #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>&nb=
sp; C</span></span><span style=3D"color:#660"><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">*</span></span><span styl=
e=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify">=
c0</span></span><span style=3D"color:#660"><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">,*</span></span><span style=3D"color:#000"><span =
style=3D"color: #000;" class=3D"styled-by-prettify">c1</span></span><span s=
tyle=3D"color:#660"><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">;</span></span><span style=3D"color:#000"><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br> H</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">hh0</span></span><span style=3D"color:#=
660"><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span></sp=
an><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-=
by-prettify"><br> P e</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">p</span></span><span style=3D"color:#660"><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">,*</span></span><span styl=
e=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify">=
p0</span></span><span style=3D"color:#660"><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">,*</span></span><span style=3D"color:#000"><span =
style=3D"color: #000;" class=3D"styled-by-prettify">p1</span></span><span s=
tyle=3D"color:#660"><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">;</span></span><span style=3D"color:#000"><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br> V</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">v0</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> </span></span><span style=3D"color:#660"><span=
style=3D"color: #660;" class=3D"styled-by-prettify">}</span></span><span s=
tyle=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"><br> <br> </span></span><span style=3D"color:#=
008"><span style=3D"color: #008;" class=3D"styled-by-prettify">void</span><=
/span><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> function_5</span></span><span style=3D"color:#660"><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">(){</span></span><span s=
tyle=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"><br> C</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">cc0</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">cc1</span>=
</span><span style=3D"color:#660"><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">;</span></span><span style=3D"color:#000"><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"><br> </span></span><=
span style=3D"color:#660"><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">}</span></span><span style=3D"color:#000"><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br> <br> </spa=
n></span><span style=3D"color:#008"><span style=3D"color: #008;" class=3D"s=
tyled-by-prettify">void</span></span><span style=3D"color:#000"><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> function_6</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: #0=
00;" class=3D"styled-by-prettify"><br> H</span><=
/span><span style=3D"color:#660"><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">*</span></span><span style=3D"color:#000"><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify">h0</span></span><span style=3D"col=
or:#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">h1</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">h2</s=
pan></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> &nb=
sp; P p</span></span><span style=3D"color:#660"><span style=3D"color: #660;=
" class=3D"styled-by-prettify">,</span></span><span style=3D"color:#000"><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify">e</span></span><spa=
n style=3D"color:#660"><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">,</span></span><span style=3D"color:#000"><span style=3D"color: #000;=
" class=3D"styled-by-prettify">a</span></span><span style=3D"color:#660"><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">;</span></span><spa=
n style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"><br> P</span></span><span style=3D"color:#=
660"><span style=3D"color: #660;" class=3D"styled-by-prettify">*</span></sp=
an><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-=
by-prettify">p0</span></span><span style=3D"color:#660"><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">;</span></span><span style=3D"color:=
#000"><span style=3D"color: #000;" class=3D"styled-by-prettify"><br> =
H</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">h=
h0</span></span><span style=3D"color:#660"><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">;</span></span><span style=3D"color:#000"><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br> =
V</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">vv0</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><span s=
tyle=3D"color:#660"><span style=3D"color: #660;" class=3D"styled-by-prettif=
y">}</span></span><span style=3D"color:#000"><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br> <br> </span></sp=
an><span style=3D"color:#008"><span style=3D"color: #008;" class=3D"styled-=
by-prettify">void</span></span><span style=3D"color:#000"><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"> function_7</span></span><span sty=
le=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;" c=
lass=3D"styled-by-prettify"><br> C</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">cc0</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"style=
d-by-prettify">cc1</span></span><span style=3D"color:#660"><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">;</span></span><span style=3D"col=
or:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbs=
p; H</span></span><span style=3D"color:#660"><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">**</span></span><span styl=
e=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify">=
hh0</span></span><span style=3D"color:#660"><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">,**</span></span><span style=3D"color:#000"><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify">hh1</span></span><spa=
n style=3D"color:#660"><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">;</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><span style=3D"color:#660"><span =
style=3D"color: #660;" class=3D"styled-by-prettify">};</span></span><span s=
tyle=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"><br></span></span></div></code></div></div></code></div><br>For example,=
It is possible that I'll write today a new function, that runs at differen=
t runtime and requires some of the above variables.<br><br>(I usually ignor=
e which variables will it exactly require until I've written the code),<br>=
<br>It would be very useful for me to have a nested namespace with the decl=
aration of all variables, letting me forget the need to declare the variabl=
es inside each new function, what could reduce the required time to imrpove=
my prototype, for example:<br><br><div class=3D"prettyprint" style=3D"back=
ground-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-=
style: solid; border-width: 1px; word-wrap: break-word;"><code class=3D"pre=
ttyprint"><div class=3D"subprettyprint"><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><div class=3D"GBT2DCHDHLB"><span style=
=3D"color:#008"><span style=3D"color: #008;" class=3D"styled-by-prettify">t=
emplate</span></span><span style=3D"color:#660"><span style=3D"color: #660;=
" class=3D"styled-by-prettify"><</span></span><span style=3D"color:#008"=
><span style=3D"color: #008;" class=3D"styled-by-prettify">typename</span><=
/span><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"> P</span></span><span style=3D"color:#660"><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">,</span></span><span style=3D"col=
or:#008"><span style=3D"color: #008;" class=3D"styled-by-prettify">typename=
</span></span><span style=3D"color:#000"><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> E</span></span><span style=3D"color:#660"><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">></span></span><span s=
tyle=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"><br></span></span><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"> GC</span></spa=
n><span style=3D"color:#660"><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">{</span></span></div><span style=3D"color:#000"><span 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">namespace</span></span><span style=3D"color:#000"><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> variables</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> C</span></span><spa=
n style=3D"color:#660"><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">*</span></span><span style=3D"color:#000"><span style=3D"color: #000;=
" class=3D"styled-by-prettify">c0</span></span><span style=3D"color:#660"><=
span style=3D"color: #660;" class=3D"styled-by-prettify">,*</span></span><s=
pan style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify">c1</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">c2</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">cc0</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"sty=
led-by-prettify">cc1</span></span><span style=3D"color:#660"><span style=3D=
"color: #660;" class=3D"styled-by-prettify">;</span></span><span style=3D"c=
olor:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&n=
bsp; H</span></span><span style=3D"color:#660"><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">*</span></span><span sty=
le=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify"=
>h0</span></span><span style=3D"color:#660"><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">,*</span></span><span style=3D"color:#000"><span=
style=3D"color: #000;" class=3D"styled-by-prettify">h1</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 style=3D"color: #000;"=
class=3D"styled-by-prettify">h2</span></span><span style=3D"color:#660"><s=
pan style=3D"color: #660;" class=3D"styled-by-prettify">,**</span></span><s=
pan style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify">hh0</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">hh1</span></s=
pan><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"c=
olor: #000;" class=3D"styled-by-prettify">hh</span><wbr><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify">h0</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"style=
d-by-prettify"><br> P e</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">p</span></span><span style=3D"color:#660"><span sty=
le=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">a=
</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 st=
yle=3D"color: #000;" class=3D"styled-by-prettify">p0</span></span><span sty=
le=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;" cl=
ass=3D"styled-by-prettify">p1</span></span><span style=3D"color:#660"><span=
style=3D"color: #660;" class=3D"styled-by-prettify">;</span></span><span s=
tyle=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"><br> V</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">v0</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">vv0</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"col=
or: #000;" class=3D"styled-by-prettify"><br> </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><br> </span></span><span s=
tyle=3D"color:#008"><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">void</span></span><span style=3D"color:#000"><span style=3D"color: #000;=
" class=3D"styled-by-prettify"> function_1</span></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 style=3D"color: #000;" class=3D"st=
yled-by-prettify"></span></span><br><span style=3D"color:#000"><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><code class=3D"prettyprint">=
<code><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"></span></span><span style=3D"color:#008"><span style=3D"col=
or: #008;" class=3D"styled-by-prettify">  =
; using</span></span><span style=3D"color:#000"><span style=3D"color:=
#000;" class=3D"styled-by-prettify"> </span></span><span style=3D"color:#0=
08"><span style=3D"color: #008;" class=3D"styled-by-prettify">namespace</sp=
an></span><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> variables</span></span><span style=3D"color:#660"><spa=
n 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-pretti=
fy"><br></span></span></code></code> </span></sp=
an><code class=3D"prettyprint"><code><code><span style=3D"color:#000"><span=
style=3D"color:#000"><span style=3D"color: #800;" class=3D"styled-by-prett=
ify">//See variables of the namespace</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"><br> </span><span sty=
le=3D"color: #008;" class=3D"styled-by-prettify">for</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify">p</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">=3D</span><span style=3D"color: #066;" class=3D"sty=
led-by-prettify">0</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify">p=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span=
><span style=3D"color: #066;" class=3D"styled-by-prettify">10</span><span s=
tyle=3D"color: #660;" class=3D"styled-by-prettify">;++</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify">p</span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">){}</span><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify"><br> c0</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">c1</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></span></code></code></code><sp=
an style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"><br> </span></span><span style=3D"color:#660"><span sty=
le=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><br> </span></span><span style=3D"color:#008"><span style=
=3D"color: #008;" class=3D"styled-by-prettify">void</span></span><span styl=
e=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify">=
function_2</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> &n=
bsp; </span></span><span style=3D"color:#008"><span style=3D"=
color: #008;" class=3D"styled-by-prettify">using</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">namespace</span></span><span style=3D"color:#000"><=
span style=3D"color: #000;" class=3D"styled-by-prettify"> variables</span><=
/span><span style=3D"color:#660"><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">;</span></span><span style=3D"color:#000"><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br> </span></span><s=
pan style=3D"color:#660"><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">}</span></span><span style=3D"color:#000"><span style=3D"color: #00=
0;" class=3D"styled-by-prettify"><br><br> </span></span><span =
style=3D"color:#008"><span style=3D"color: #008;" class=3D"styled-by-pretti=
fy">void</span></span><span style=3D"color:#000"><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> function_3</span></span><span style=3D"col=
or:#660"><span style=3D"color: #660;" class=3D"styled-by-prettify">(){</spa=
n></span><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"><br> </span></span><span styl=
e=3D"color:#008"><span style=3D"color: #008;" class=3D"styled-by-prettify">=
using</span></span><span style=3D"color:#000"><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> </span></span><span style=3D"color:#008"><spa=
n style=3D"color: #008;" class=3D"styled-by-prettify">namespace</span></spa=
n><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> variables</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><span style=3D"color:#660"><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">}</span></span><span style=3D"colo=
r:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br>&=
nbsp; </span></span><span style=3D"color:#008"><span style=3D"color:=
#008;" class=3D"styled-by-prettify">void</span></span><span style=3D"color=
:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify"> function_=
4</span></span><span style=3D"color:#660"><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">(){</span></span><span style=3D"color:#000"><span =
style=3D"color: #000;" class=3D"styled-by-prettify"><br>  =
; </span></span><span style=3D"color:#008"><span style=3D"color: #00=
8;" class=3D"styled-by-prettify">using</span></span><span style=3D"color:#0=
00"><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span></spa=
n><span style=3D"color:#008"><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">namespace</span></span><span style=3D"color:#000"><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> variables</span></span><spa=
n style=3D"color:#660"><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">;</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><br> </span></span><span style=3D"=
color:#008"><span style=3D"color: #008;" class=3D"styled-by-prettify">void<=
/span></span><span style=3D"color:#000"><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> function_5</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><span style=3D"col=
or:#008"><span style=3D"color: #008;" class=3D"styled-by-prettify">using</s=
pan></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">namespace</span></span><span=
style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> variables</span></span><span style=3D"color:#660"><span style=3D"colo=
r: #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><span style=3D"color:#660"><span style=3D"color: #660;=
" class=3D"styled-by-prettify">}</span></span><span style=3D"color:#000"><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"><br><br> &nbs=
p; </span></span><span style=3D"color:#008"><span style=3D"color: #008;" cl=
ass=3D"styled-by-prettify">void</span></span><span style=3D"color:#000"><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> function_6</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"c=
olor: #000;" class=3D"styled-by-prettify"><br> <=
/span></span><span style=3D"color:#008"><span style=3D"color: #008;" class=
=3D"styled-by-prettify">using</span></span><span style=3D"color:#000"><span=
style=3D"color: #000;" class=3D"styled-by-prettify"> </span></span><span s=
tyle=3D"color:#008"><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">namespace</span></span><span style=3D"color:#000"><span style=3D"color: =
#000;" class=3D"styled-by-prettify"> variables</span></span><span style=3D"=
color:#660"><span style=3D"color: #660;" class=3D"styled-by-prettify">;</sp=
an></span><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"=
styled-by-prettify"><br> </span></span><span style=3D"color:#6=
60"><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span></spa=
n><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"><br><br> </span></span><span style=3D"color:#008">=
<span style=3D"color: #008;" class=3D"styled-by-prettify">void</span></span=
><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> function_7</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><span style=3D"color:#008"><sp=
an style=3D"color: #008;" class=3D"styled-by-prettify">using</span></span><=
span style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"> </span></span><span style=3D"color:#008"><span style=3D"color: #0=
08;" class=3D"styled-by-prettify">namespace</span></span><span style=3D"col=
or:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify"> variabl=
es</span></span><span style=3D"color:#660"><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">;</span></span><span style=3D"color:#000"><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"><br> </span=
></span><span style=3D"color:#660"><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">}</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></div></code></div></div></code><=
/div><br>These variables would have the same lifetime of the objects lifeti=
me. This is really irrelevant for me, but for those cases, where it is rele=
vant, I suggest David's idea:<br><br><div class=3D"prettyprint" style=3D"ba=
ckground-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); borde=
r-style: solid; border-width: 1px; word-wrap: break-word;"><code class=3D"p=
rettyprint"><div class=3D"subprettyprint"><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><div style=3D"background-color:rgb(2=
50,250,250);border-color:rgb(187,187,187);border-style:solid;border-width:1=
px;word-wrap:break-word"><code><div><div class=3D"GBT2DCHDHLB"><div><span s=
tyle=3D"color:#008"><span style=3D"color:#008"><span style=3D"color: #008;"=
class=3D"styled-by-prettify">template</span></span></span><span style=3D"c=
olor:#660"><span style=3D"color:#660"><span style=3D"color: #660;" class=3D=
"styled-by-prettify"><</span></span></span><span style=3D"color:#008"><s=
pan style=3D"color:#008"><span style=3D"color: #008;" class=3D"styled-by-pr=
ettify">typename</span></span></span><span style=3D"color:#000"><span style=
=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
P</span></span></span><span style=3D"color:#660"><span style=3D"color:#660"=
><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span></span><=
/span><span style=3D"color:#008"><span style=3D"color:#008"><span style=3D"=
color: #008;" class=3D"styled-by-prettify">typename</span></span></span><sp=
an style=3D"color:#000"><span style=3D"color:#000"><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> E</span></span></span><span style=3D"col=
or:#660"><span style=3D"color:#660"><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">></span></span></span><span style=3D"color:#000"><spa=
n style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"><br></span></span></span><span style=3D"color:#008"><span style=3D"co=
lor:#008"><span style=3D"color: #008;" class=3D"styled-by-prettify">class</=
span></span></span><span style=3D"color:#000"><span style=3D"color:#000"><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> GC</span></span></=
span><span style=3D"color:#660"><span style=3D"color:#660"><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">{</span></span></span></div></div=
><span style=3D"color:#000"><span style=3D"color:#000"><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> </span><span style=3D"c=
olor: #008;" class=3D"styled-by-prettify">struct</span></span></span><span =
style=3D"color:#008"><span style=3D"color:#008"></span></span><span style=
=3D"color:#000"><span style=3D"color:#000"><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> variables</span></span></span><span style=3D"col=
or:#660"><span style=3D"color:#660"><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">{</span></span></span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br></span><span style=3D"color:#660"><span style=
=3D"color:#660"></span></span><div class=3D"GBT2DCHDHLB"><span style=3D"col=
or:#000"><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> C</span></span></span><span =
style=3D"color:#660"><span style=3D"color:#660"><span style=3D"color: #660;=
" class=3D"styled-by-prettify">*</span></span></span><span style=3D"color:#=
000"><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"style=
d-by-prettify">c0</span></span></span><span style=3D"color:#660"><span styl=
e=3D"color:#660"><span style=3D"color: #660;" class=3D"styled-by-prettify">=
,*</span></span></span><span style=3D"color:#000"><span style=3D"color:#000=
"><span style=3D"color: #000;" class=3D"styled-by-prettify">c1</span></span=
></span><span style=3D"color:#660"><span style=3D"color:#660"><span style=
=3D"color: #660;" class=3D"styled-by-prettify">,*</span></span></span><span=
style=3D"color:#000"><span style=3D"color:#000"><span style=3D"color: #000=
;" class=3D"styled-by-prettify">c2</span></span></span><span style=3D"color=
:#660"><span style=3D"color:#660"><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">,**</span></span></span><span style=3D"color:#000"><span s=
tyle=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-prettif=
y">cc0</span></span></span><span style=3D"color:#660"><span style=3D"color:=
#660"><span style=3D"color: #660;" class=3D"styled-by-prettify">,**</span><=
/span></span><span style=3D"color:#000"><span style=3D"color:#000"><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify">cc1</span></span></span><=
span style=3D"color:#660"><span style=3D"color:#660"><span style=3D"color: =
#660;" class=3D"styled-by-prettify">;</span></span></span><span style=3D"co=
lor:#000"><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"=
styled-by-prettify"><br> H</span></span></span><=
span style=3D"color:#660"><span style=3D"color:#660"><span style=3D"color: =
#660;" class=3D"styled-by-prettify">*</span></span></span><span style=3D"co=
lor:#000"><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"=
styled-by-prettify">h0</span></span></span><span style=3D"color:#660"><span=
style=3D"color:#660"><span style=3D"color: #660;" class=3D"styled-by-prett=
ify">,*</span></span></span><span style=3D"color:#000"><span style=3D"color=
:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify">h1</span><=
/span></span><span style=3D"color:#660"><span style=3D"color:#660"><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">,*</span></span></span><s=
pan style=3D"color:#000"><span style=3D"color:#000"><span style=3D"color: #=
000;" class=3D"styled-by-prettify">h2</span></span></span><span style=3D"co=
lor:#660"><span style=3D"color:#660"><span style=3D"color: #660;" class=3D"=
styled-by-prettify">,**</span></span></span><span style=3D"color:#000"><spa=
n style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by-pret=
tify">hh0</span></span></span><span style=3D"color:#660"><span style=3D"col=
or:#660"><span style=3D"color: #660;" class=3D"styled-by-prettify">,**</spa=
n></span></span><span style=3D"color:#000"><span style=3D"color:#000"><span=
style=3D"color: #000;" class=3D"styled-by-prettify">hh1</span></span></spa=
n><span style=3D"color:#660"><span style=3D"color:#660"><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">,***</span></span></span><span style=
=3D"color:#000"><span style=3D"color:#000"><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify">hh</span></span><span style=3D"color:#000"><wbr><=
span style=3D"color: #000;" class=3D"styled-by-prettify">h0</span></span></=
span><span style=3D"color:#660"><span style=3D"color:#660"><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">;</span></span></span><span style=
=3D"color:#000"><span style=3D"color:#000"><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br> P e</span></span>=
</span><span style=3D"color:#660"><span style=3D"color:#660"><span style=3D=
"color: #660;" class=3D"styled-by-prettify">,</span></span></span><span sty=
le=3D"color:#000"><span style=3D"color:#000"><span style=3D"color: #000;" c=
lass=3D"styled-by-prettify">p</span></span></span><span style=3D"color:#660=
"><span style=3D"color:#660"><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">,</span></span></span><span style=3D"color:#000"><span style=3D=
"color:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify">a</s=
pan></span></span><span style=3D"color:#660"><span style=3D"color:#660"><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">,*</span></span></sp=
an><span style=3D"color:#000"><span style=3D"color:#000"><span style=3D"col=
or: #000;" class=3D"styled-by-prettify">p0</span></span></span><span style=
=3D"color:#660"><span style=3D"color:#660"><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">,*</span></span></span><span style=3D"color:#000"=
><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"styled-by=
-prettify">p1</span></span></span><span style=3D"color:#660"><span style=3D=
"color:#660"><span style=3D"color: #660;" class=3D"styled-by-prettify">;</s=
pan></span></span><span style=3D"color:#000"><span style=3D"color:#000"><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"><br> &n=
bsp; V</span></span></span><span style=3D"color:#660"><span style=3D=
"color:#660"><span style=3D"color: #660;" class=3D"styled-by-prettify">*</s=
pan></span></span><span style=3D"color:#000"><span style=3D"color:#000"><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify">v0</span></span></sp=
an><span style=3D"color:#660"><span style=3D"color:#660"><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">,**</span></span></span><span style=
=3D"color:#000"><span style=3D"color:#000"><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify">vv0</span></span></span><span style=3D"color:#660=
"><span style=3D"color:#660"><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">;</span></span></span><span style=3D"color:#000"><span style=3D=
"color:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
</span></span></span><span style=3D"color:#660"><span style=
=3D"color:#660"><span style=3D"color: #660;" class=3D"styled-by-prettify">}=
</span></span></span><span style=3D"color:#000"><span style=3D"color:#000">=
<span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br> &n=
bsp; </span></span></span><span style=3D"color:#008"><span style=3D"color:#=
008"><span style=3D"color: #008;" class=3D"styled-by-prettify">void</span><=
/span></span><span style=3D"color:#000"><span style=3D"color:#000"><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> function_1</span></span>=
</span><span style=3D"color:#660"><span style=3D"color:#660"><span style=3D=
"color: #660;" class=3D"styled-by-prettify">(){</span></span></span><span s=
tyle=3D"color:#000"><span style=3D"color:#000"><span style=3D"color: #000;"=
class=3D"styled-by-prettify"><br></span></span><span style=3D"color:#000">=
</span></span></div><code><code><span style=3D"color:#000"><span style=3D"c=
olor:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
</span></span></span><span style=3D"color:#008"><span=
style=3D"color:#008"><span style=3D"color: #008;" class=3D"styled-by-prett=
ify">using</span></span></span><span style=3D"color:#000"><span style=3D"co=
lor:#000"><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span=
></span></span><span style=3D"color:#008"><span style=3D"color:#606"><span =
style=3D"color: #000;" class=3D"styled-by-prettify">variables</span></span>=
</span><span style=3D"color:#000"><span style=3D"color:#000"><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> </span></span><span style=3D"c=
olor:#008"><span style=3D"color: #000;" class=3D"styled-by-prettify">as_nam=
espace</span></span></span><span style=3D"color:#660"><span style=3D"color:=
#660"><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span></s=
pan></span><span style=3D"color:#000"><span style=3D"color:#000"></span></s=
pan></code></code><span style=3D"color:#000"><span style=3D"color:#000"><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"><br> &n=
bsp; </span><span style=3D"color: #800;" class=3D"styled-by-prettify=
">//See variables of the object</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"><br> </span><span style=3D"=
color: #008;" class=3D"styled-by-prettify">for</span><span style=3D"color: =
#660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify">p</span><span style=3D"color: #660;" class=3D"st=
yled-by-prettify">=3D</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">p</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify"><</span><span=
style=3D"color: #066;" class=3D"styled-by-prettify">10</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">;++</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify">p</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">){}</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br> c0</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">c1</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br> </span></span></span><span style=
=3D"color:#660"><span style=3D"color:#660"><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">}</span></span></span><span style=3D"color:#000">=
</span><span style=3D"color:#000"><span style=3D"color:#000"><span style=3D=
"color: #000;" class=3D"styled-by-prettify"><br></span></span></span><span =
style=3D"color:#660"><span style=3D"color:#660"><span style=3D"color: #660;=
" class=3D"styled-by-prettify">};</span></span></span><span style=3D"color:=
#000"><span style=3D"color:#000"><span style=3D"color: #000;" class=3D"styl=
ed-by-prettify"><br></span></span></span></div></code></div></div></code></=
div></div></code></div><br>It would create an entire object of type <span s=
tyle=3D"background-color: rgb(238, 238, 238);">variables</span> called <spa=
n style=3D"background-color: rgb(238, 238, 238);">as_namespace</span> whose=
lifetime would depend on " } " character and the word <span style=3D"font-=
family: courier new,monospace;">using</span> would allow to see its variabl=
es without the need to write:<br><br><div class=3D"prettyprint" style=3D"ba=
ckground-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); borde=
r-style: solid; border-width: 1px; word-wrap: break-word;"><code class=3D"p=
rettyprint"><div class=3D"subprettyprint"><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify">as_namespace</span><span style=3D"color: #660;" cl=
ass=3D"styled-by-prettify">.</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify">c0</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
><br>as_namespace</span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">.</span><span style=3D"color: #000;" class=3D"styled-by-prettify">c1=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"><br>as_namespace.p;=
<br></span></div></code></div><br>When the final prototype is reached, I wo=
uld copy and paste the namespace content into each function and run a scrip=
t that removes all the unused variables, this with the intention of making =
it more maintainable.<br><br>PF, ncomputers<br><br>Am Donnerstag, 23. Oktob=
er 2014 12:24:43 UTC-5 schrieb Ville Voutilainen:<blockquote class=3D"gmail=
_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;p=
adding-left: 1ex;">On 23 October 2014 20:21, <<a href=3D"javascrip=
t:" target=3D"_blank" gdf-obfuscated-mailto=3D"By7bY7auNAwJ" onmousedown=3D=
"this.href=3D'javascript:';return true;" onclick=3D"this.href=3D'javascript=
:';return true;">con...@ncomputers.org</a>> wrote:
<br>> Nevin, thank you very much for your answer.
<br>>
<br>>> But in good C++ code, 99% of local variables should be declare=
d at the
<br>>> point of first use.
<br>>
<br>>
<br>> I agree partially with it. When writing a release version, I would=
declare
<br>> variables at the point of first use. David's proposal could be use=
ful for
<br>> this. (Using objects as namespace)
<br>>
<br>> For example:
<br>>
<br>> template<typename P,typename E>
<br>> class GC{
<br>> struct variables{
<br>> C*c0,*c1,*c2,**cc0,**cc1;
<br>> H*h0,*h1,*h2,**hh0,**hh1,***<wbr>hhh0;
<br>> P e,p,a,*p0,*p1;
<br>> V*v0,**vv0;
<br>> }
<br>>
<br>> void function_1(){
<br>> using variables as_namespace;
<br>> }
<br>> };
<br>
<br>
<br>I don't know about others, but I'm completely at loss about what these =
examples
<br>are meant to illustrate. I do not understand why you want to declare
<br>the same local
<br>variables in every member function of a class.
<br></blockquote></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_866_1940567141.1414087720066--
.
Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Thu, 23 Oct 2014 21:31:13 +0300
Raw View
On 23 October 2014 21:08, <contact@ncomputers.org> wrote:
> Ville,
>
> Thank you very much for your comments!
>
> Ok, I'll try to explain it better and take your comment into account.
>
> This is an example of a real code. It has some functions that use almost the
> same variables to compute the data. It is taken from (Graph Coloring.cpp)
>
> All functions run at different runtimes. I'm using evolutionary prototyping
> to write it and it requires to change it all the time.
Use a nested struct combined with a local class inheriting from it, and put
the code you would normally write in a function body into the constructor
of that local class:
#include <iostream>
struct MyGC
{
struct variables {
int a=42, b=666, c=99;
};
void f()
{
struct localvars : variables
{
localvars()
{
std::cout << "a is " << a << ", b is " << b << ", c is
" << c << std::endl;
}
} lv;
}
};
int main()
{
MyGC m;
m.f();
}
--
---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
.
Author: oliver.j.nadler@gmail.com
Date: Thu, 23 Oct 2014 11:44:36 -0700 (PDT)
Raw View
------=_Part_419_1493337414.1414089876568
Content-Type: text/plain; charset=UTF-8
Ville,
Thank you very much for your suggestion!
You have taught me something new today! I didn't know that it is possible
to write a struct inside a function!
Note that it would be possible to write your code in a more readable and
understable way with this proposal.
#include <iostream>
struct MyGC
{
struct variables {
int a=42, b=666, c=99;
};
void f()
{
struct localvars : variables
{
localvars()
{
std::cout << "a is " << a << ", b is " << b << ", c is
" << c << std::endl;
}
} lv;
}
};
int main()
{
MyGC m;
m.f();
}
With *nested namespaces* and *objects as namespace*:
#include <iostream>
struct MyGC{
struct variables{
int a=42,b=666,c=99;
};
void f(){
using variables as_namespace;
std::cout << "a is " << a << ", b is " << b << ", c is" << c << std
::endl;
}
};
int main(){
MyGC m;
m.f();
}
PF, ncomputers
Am Donnerstag, 23. Oktober 2014 13:31:15 UTC-5 schrieb Ville Voutilainen:
>
> On 23 October 2014 21:08, <con...@ncomputers.org <javascript:>> wrote:
> > Ville,
> >
> > Thank you very much for your comments!
> >
> > Ok, I'll try to explain it better and take your comment into account.
> >
> > This is an example of a real code. It has some functions that use almost
> the
> > same variables to compute the data. It is taken from (Graph
> Coloring.cpp)
> >
> > All functions run at different runtimes. I'm using evolutionary
> prototyping
> > to write it and it requires to change it all the time.
>
> Use a nested struct combined with a local class inheriting from it, and
> put
> the code you would normally write in a function body into the constructor
> of that local class:
>
> #include <iostream>
>
> struct MyGC
> {
> struct variables {
> int a=42, b=666, c=99;
> };
> void f()
> {
> struct localvars : variables
> {
> localvars()
> {
> std::cout << "a is " << a << ", b is " << b << ", c is
> " << c << std::endl;
> }
> } lv;
> }
> };
>
> int main()
> {
> MyGC m;
> m.f();
> }
>
--
---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_419_1493337414.1414089876568
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Ville,<br><br>Thank you very much for your suggestion!<br>=
<br>You have taught me something new today! I didn't know that it is possib=
le to write a struct inside a function!<br><br>Note that it would be possib=
le to write your code in a more readable and understable way with this prop=
osal.<br><br><div class=3D"prettyprint" style=3D"background-color: rgb(250,=
250, 250); border-color: rgb(187, 187, 187); border-style: solid; border-w=
idth: 1px; word-wrap: break-word;"><code class=3D"prettyprint"><div class=
=3D"subprettyprint"><span style=3D"color: #800;" class=3D"styled-by-prettif=
y">#include</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> </span><span style=3D"color: #080;" class=3D"styled-by-prettify"><iost=
ream></span><span style=3D"color: #000;" class=3D"styled-by-prettify"> <=
br> <br></span><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">struct</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
</span><span style=3D"color: #606;" class=3D"styled-by-prettify">MyGC</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> <br></span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> <br> </span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">struct</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> variables </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">int</spa=
n><span style=3D"color: #000;" class=3D"styled-by-prettify"> a</span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=
=3D"color: #066;" class=3D"styled-by-prettify">42</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;"=
class=3D"styled-by-prettify"> b</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">=3D</span><span style=3D"color: #066;" class=3D"sty=
led-by-prettify">666</span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> c</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=3D</sp=
an><span style=3D"color: #066;" class=3D"styled-by-prettify">99</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> </span><s=
pan style=3D"color: #008;" class=3D"styled-by-prettify">void</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> f</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">()</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> <br> </span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> <br> </span><=
span style=3D"color: #008;" class=3D"styled-by-prettify">struct</span><span=
style=3D"color: #000;" class=3D"styled-by-prettify"> localvars </span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">:</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> variables <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=
> localvars</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">()</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> <br> &=
nbsp; </span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> <br> &=
nbsp; std</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">::</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify">cout </span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify"><<</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #080;" class=3D"sty=
led-by-prettify">"a is "</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-prettif=
y"> a </span><span style=3D"color: #660;" class=3D"styled-by-prettify"><=
<</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </spa=
n><span style=3D"color: #080;" class=3D"styled-by-prettify">", b is "</span=
><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify"><<</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> b </span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify"><<</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #080;"=
class=3D"styled-by-prettify">", c is <br>"</span><span style=3D"color: #00=
0;" 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"> c </span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify"><<</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> std</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">::</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
>endl</span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> <br> &n=
bsp; </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-prettify">}</span><span style=3D"color: #000;" =
class=3D"styled-by-prettify"> lv</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-prettify">}</span><span style=3D"color: #000;" class=3D"style=
d-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> <br></span><span style=3D"color: #008;" class=3D"styled-by-pre=
ttify">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: #000;" class=3D"styled-by-prettify"> <br></span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> <br> </span><=
span style=3D"color: #606;" class=3D"styled-by-prettify">MyGC</span><span s=
tyle=3D"color: #000;" class=3D"styled-by-prettify"> m</span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">;</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> <br> m</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">.</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify">f</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">();</span><span style=3D"color: #000;" class=3D"s=
tyled-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></span></div></code></div><br>With <b>nested namespaces</b> and <=
b>objects as namespace</b>:<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;"><cod=
e class=3D"prettyprint"><div class=3D"subprettyprint"><span style=3D"color:=
#800;" class=3D"styled-by-prettify">#include</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #080;" cla=
ss=3D"styled-by-prettify"><iostream></span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"><br><br></span><span style=3D"color: #008;"=
class=3D"styled-by-prettify">struct</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"> </span><span style=3D"color: #606;" class=3D"sty=
led-by-prettify">MyGC</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">struct</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> variables</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br=
> </span><span style=3D"color: #008;" class=3D"s=
tyled-by-prettify">int</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"> a</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">=3D</span><span style=3D"color: #066;" class=3D"styled-by-prettify">42<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify">b</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">=3D</span><span style=3D"col=
or: #066;" class=3D"styled-by-prettify">666</span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify">c</span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">=3D</span><span style=3D"color: #066;" class=3D"styled-by-pr=
ettify">99</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><br>&=
nbsp; </span><span style=3D"color: #008;" class=3D"styled-by-prettif=
y">void</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> f<=
/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-pretti=
fy">using</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
variables as_namespace</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> std</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">::</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify">cout </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify"><<</span><span style=3D"color: #000;" class=3D"styled-=
by-prettify"> </span><span style=3D"color: #080;" class=3D"styled-by-pretti=
fy">"a is "</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"> a </span>=
<span style=3D"color: #660;" class=3D"styled-by-prettify"><<</span><s=
pan style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=
=3D"color: #080;" class=3D"styled-by-prettify">", b is "</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"> b </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: #080;" class=3D"st=
yled-by-prettify">", c is"</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-prett=
ify"> c </span><span style=3D"color: #660;" class=3D"styled-by-prettify">&l=
t;<</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> std=
</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</span><=
span style=3D"color: #000;" class=3D"styled-by-prettify">endl</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> </span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">}</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">};</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"><br></span><br><code class=3D"prettyprint"><span=
style=3D"color: #008;" class=3D"styled-by-prettify">int</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> main</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">()</span>{<span style=3D"color: #=
660;" class=3D"styled-by-prettify"></span><span style=3D"color: #000;" clas=
s=3D"styled-by-prettify"><br> </span><span style=3D"color: #60=
6;" class=3D"styled-by-prettify">MyGC</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> m</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">;</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify"><br> m</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">.</span><span style=3D"color: #000;" class=3D"styled-by-=
prettify">f</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><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"><br></span></code></d=
iv></code></div><br>PF, ncomputers<br><br>Am Donnerstag, 23. Oktober 2014 1=
3:31:15 UTC-5 schrieb Ville Voutilainen:<blockquote class=3D"gmail_quote" s=
tyle=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-le=
ft: 1ex;">On 23 October 2014 21:08, <<a href=3D"javascript:" targe=
t=3D"_blank" gdf-obfuscated-mailto=3D"Id1el7QQbu4J" onmousedown=3D"this.hre=
f=3D'javascript:';return true;" onclick=3D"this.href=3D'javascript:';return=
true;">con...@ncomputers.org</a>> wrote:
<br>> Ville,
<br>>
<br>> Thank you very much for your comments!
<br>>
<br>> Ok, I'll try to explain it better and take your comment into accou=
nt.
<br>>
<br>> This is an example of a real code. It has some functions that use =
almost the
<br>> same variables to compute the data. It is taken from (Graph Colori=
ng.cpp)
<br>>
<br>> All functions run at different runtimes. I'm using evolutionary pr=
ototyping
<br>> to write it and it requires to change it all the time.
<br>
<br>Use a nested struct combined with a local class inheriting from it, and=
put
<br>the code you would normally write in a function body into the construct=
or
<br>of that local class:
<br>
<br>#include <iostream>
<br>
<br>struct MyGC
<br>{
<br> struct variables {
<br> int a=3D42, b=3D666, c=3D99;
<br> };
<br> void f()
<br> {
<br> struct localvars : variables
<br> {
<br> localvars()
<br> {
<br> std::cout <&=
lt; "a is " << a << ", b is " << b << ", c is
<br>" << c << std::endl;
<br> }
<br> } lv;
<br> }
<br>};
<br>
<br>int main()
<br>{
<br> MyGC m;
<br> m.f();
<br>}
<br></blockquote></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_419_1493337414.1414089876568--
.
Author: contact@ncomputers.org
Date: Thu, 23 Oct 2014 11:46:10 -0700 (PDT)
Raw View
------=_Part_354_424693517.1414089970698
Content-Type: text/plain; charset=UTF-8
Ville,
Thank you very much for your suggestion!
You have taught me something new today! I didn't know that it is possible
to write a struct inside a function!
I think that it would be possible to write your code in a more readable and
understable way with this proposal.
#include <iostream>
struct MyGC
{
struct variables {
int a=42, b=666, c=99;
};
void f()
{
struct localvars : variables
{
localvars()
{
std::cout << "a is " << a << ", b is " << b << ", c is
" << c << std::endl;
}
} lv;
}
};
int main()
{
MyGC m;
m.f();
}
With *nested namespaces* and *objects as namespace*:
#include <iostream>
struct MyGC{
struct variables{
int a=42,b=666,c=99;
};
void f(){
using variables as_namespace;
std::cout << "a is " << a << ", b is " << b << ", c is" << c << std
::endl;
}
};
int main(){
MyGC m;
m.f();
}
PF, ncomputers
Am Donnerstag, 23. Oktober 2014 13:31:15 UTC-5 schrieb Ville Voutilainen:
>
> On 23 October 2014 21:08, <con...@ncomputers.org <javascript:>> wrote:
> > Ville,
> >
> > Thank you very much for your comments!
> >
> > Ok, I'll try to explain it better and take your comment into account.
> >
> > This is an example of a real code. It has some functions that use almost
> the
> > same variables to compute the data. It is taken from (Graph
> Coloring.cpp)
> >
> > All functions run at different runtimes. I'm using evolutionary
> prototyping
> > to write it and it requires to change it all the time.
>
> Use a nested struct combined with a local class inheriting from it, and
> put
> the code you would normally write in a function body into the constructor
> of that local class:
>
> #include <iostream>
>
> struct MyGC
> {
> struct variables {
> int a=42, b=666, c=99;
> };
> void f()
> {
> struct localvars : variables
> {
> localvars()
> {
> std::cout << "a is " << a << ", b is " << b << ", c is
> " << c << std::endl;
> }
> } lv;
> }
> };
>
> int main()
> {
> MyGC m;
> m.f();
> }
>
--
---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_354_424693517.1414089970698
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Ville,<br><br>Thank you very much for your suggestion!<br>=
<br>You have taught me something new today! I didn't know that it is possib=
le to write a struct inside a function!<br><br>I think that it would be pos=
sible to write your code in a more readable and understable way with this p=
roposal.<br><br><div style=3D"background-color:rgb(250,250,250);border-colo=
r:rgb(187,187,187);border-style:solid;border-width:1px;word-wrap:break-word=
"><code><div><span style=3D"color:#800">#include</span><span style=3D"color=
:#000"> </span><span style=3D"color:#080"><iostream></span><span styl=
e=3D"color:#000"> <br> <br></span><span style=3D"color:#008">struct</s=
pan><span style=3D"color:#000"> </span><span style=3D"color:#606">MyGC</spa=
n><span style=3D"color:#000"> <br></span><span style=3D"color:#660">{</span=
><span style=3D"color:#000"> <br> </span><span style=3D"color:=
#008">struct</span><span style=3D"color:#000"> variables </span><span style=
=3D"color:#660">{</span><span style=3D"color:#000"> <br>  =
; </span><span style=3D"color:#008">int</span><span style=3D"color:#=
000"> a</span><span style=3D"color:#660">=3D</span><span style=3D"color:#06=
6">42</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> =
b</span><span style=3D"color:#660">=3D</span><span style=3D"color:#066">666=
</span><span style=3D"color:#660">,</span><span style=3D"color:#000"> c</sp=
an><span style=3D"color:#660">=3D</span><span style=3D"color:#066">99</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><span style=3D"color:#008">void</span><span sty=
le=3D"color:#000"> f</span><span style=3D"color:#660">()</span><span style=
=3D"color:#000"> <br> </span><span style=3D"color:#660">{</spa=
n><span style=3D"color:#000"> <br> </span><span =
style=3D"color:#008">struct</span><span style=3D"color:#000"> localvars </s=
pan><span style=3D"color:#660">:</span><span style=3D"color:#000"> variable=
s <br> </span><span style=3D"color:#660">{</span=
><span style=3D"color:#000"> <br> =
localvars</span><span style=3D"color:#660">()</span><span style=3D"color:#0=
00"> <br> </span><span style=3D"co=
lor:#660">{</span><span style=3D"color:#000"> <br> &nbs=
p; std</span><span style=3D"color:#660">::</spa=
n><span style=3D"color:#000">cout </span><span style=3D"color:#660"><<=
;</span><span style=3D"color:#000"> </span><span style=3D"color:#080">"a is=
"</span><span style=3D"color:#000"> </span><span style=3D"color:#660"><=
<</span><span style=3D"color:#000"> a </span><span style=3D"color:#660">=
<<</span><span style=3D"color:#000"> </span><span style=3D"color:#080=
">", b is "</span><span style=3D"color:#000"> </span><span style=3D"color:#=
660"><<</span><span style=3D"color:#000"> b </span><span style=3D"col=
or:#660"><<</span><span style=3D"color:#000"> </span><span style=3D"c=
olor:#080">", c is <br>"</span><span style=3D"color:#000"> </span><span sty=
le=3D"color:#660"><<</span><span style=3D"color:#000"> c </span><span=
style=3D"color:#660"><<</span><span style=3D"color:#000"> std</span>=
<span style=3D"color:#660">::</span><span style=3D"color:#000">endl</span><=
span style=3D"color:#660">;</span><span style=3D"color:#000"> <br> &n=
bsp; </span><span style=3D"color:#660">}</span>=
<span style=3D"color:#000"> <br> </span><span st=
yle=3D"color:#660">}</span><span style=3D"color:#000"> lv</span><span style=
=3D"color:#660">;</span><span style=3D"color:#000"> <br> </spa=
n><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:#008">int</span><span style=3D"color:#000">=
main</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><span style=3D"color:#606">MyGC</span><span style=
=3D"color:#000"> m</span><span style=3D"color:#660">;</span><span style=3D"=
color:#000"> <br> m</span><span style=3D"color:#660">.</span><=
span style=3D"color:#000">f</span><span style=3D"color:#660">();</span><spa=
n style=3D"color:#000"> <br></span><span style=3D"color:#660">}</span><span=
style=3D"color:#000"> <br></span></div></code></div><br>With <b>nested nam=
espaces</b> and <b>objects as namespace</b>:<br> <br><div styl=
e=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:#800">#include</span><span style=3D"color:#000"> </span><span sty=
le=3D"color:#080"><iostream></span><span style=3D"color:#000"><br><br=
></span><span style=3D"color:#008">struct</span><span style=3D"color:#000">=
</span><span style=3D"color:#606">MyGC</span><span style=3D"color:#660">{<=
/span><span style=3D"color:#000"><br> </span><span style=3D"co=
lor:#008">struct</span><span style=3D"color:#000"> variables</span><span st=
yle=3D"color:#660">{</span><span style=3D"color:#000"><br> &nb=
sp; </span><span style=3D"color:#008">int</span><span style=3D"color=
:#000"> a</span><span style=3D"color:#660">=3D</span><span style=3D"color:#=
066">42</span><span style=3D"color:#660">,</span><span style=3D"color:#000"=
>b</span><span style=3D"color:#660">=3D</span><span style=3D"color:#066">66=
6</span><span style=3D"color:#660">,</span><span style=3D"color:#000">c</sp=
an><span style=3D"color:#660">=3D</span><span style=3D"color:#066">99</span=
><span style=3D"color:#660">;</span><span style=3D"color:#000"><br> &=
nbsp; </span><span style=3D"color:#660">};</span><span style=3D"color:#000"=
><br><br> </span><span style=3D"color:#008">void</span><span s=
tyle=3D"color:#000"> f</span><span style=3D"color:#660">(){</span><span sty=
le=3D"color:#000"><br> </span><span style=3D"col=
or:#008">using</span><span style=3D"color:#000"> variables as_namespace</sp=
an><span style=3D"color:#660">;</span><span style=3D"color:#000"><br> =
std</span><span style=3D"color:#660">::</span><span s=
tyle=3D"color:#000">cout </span><span style=3D"color:#660"><<</span><=
span style=3D"color:#000"> </span><span style=3D"color:#080">"a is "</span>=
<span style=3D"color:#000"> </span><span style=3D"color:#660"><<</spa=
n><span style=3D"color:#000"> a </span><span style=3D"color:#660"><<<=
/span><span style=3D"color:#000"> </span><span style=3D"color:#080">", b is=
"</span><span style=3D"color:#000"> </span><span style=3D"color:#660"><=
<</span><span style=3D"color:#000"> b </span><span style=3D"color:#660">=
<<</span><span style=3D"color:#000"> </span><span style=3D"color:#080=
">", c is"</span><span style=3D"color:#000"> </span><span style=3D"color:#6=
60"><<</span><span style=3D"color:#000"> c </span><span style=3D"colo=
r:#660"><<</span><span style=3D"color:#000"> std</span><span style=3D=
"color:#660">::</span><span style=3D"color:#000">endl</span><span style=3D"=
color:#660">;</span><span style=3D"color:#000"><br> </span><sp=
an 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><br><c=
ode><span style=3D"color:#008">int</span><span style=3D"color:#000"> main</=
span><span style=3D"color:#660">()</span>{<span style=3D"color:#660"></span=
><span style=3D"color:#000"><br> </span><span style=3D"color:#=
606">MyGC</span><span style=3D"color:#000"> m</span><span style=3D"color:#6=
60">;</span><span style=3D"color:#000"><br> m</span><span styl=
e=3D"color:#660">.</span><span style=3D"color:#000">f</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></co=
de></div><br>PF, ncomputers<br><br>Am Donnerstag, 23. Oktober 2014 13:31:15=
UTC-5 schrieb Ville Voutilainen:<blockquote class=3D"gmail_quote" style=3D=
"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex=
;">On 23 October 2014 21:08, <<a href=3D"javascript:" target=3D"_b=
lank" gdf-obfuscated-mailto=3D"Id1el7QQbu4J" onmousedown=3D"this.href=3D'ja=
vascript:';return true;" onclick=3D"this.href=3D'javascript:';return true;"=
>con...@ncomputers.org</a>> wrote:
<br>> Ville,
<br>>
<br>> Thank you very much for your comments!
<br>>
<br>> Ok, I'll try to explain it better and take your comment into accou=
nt.
<br>>
<br>> This is an example of a real code. It has some functions that use =
almost the
<br>> same variables to compute the data. It is taken from (Graph Colori=
ng.cpp)
<br>>
<br>> All functions run at different runtimes. I'm using evolutionary pr=
ototyping
<br>> to write it and it requires to change it all the time.
<br>
<br>Use a nested struct combined with a local class inheriting from it, and=
put
<br>the code you would normally write in a function body into the construct=
or
<br>of that local class:
<br>
<br>#include <iostream>
<br>
<br>struct MyGC
<br>{
<br> struct variables {
<br> int a=3D42, b=3D666, c=3D99;
<br> };
<br> void f()
<br> {
<br> struct localvars : variables
<br> {
<br> localvars()
<br> {
<br> std::cout <&=
lt; "a is " << a << ", b is " << b << ", c is
<br>" << c << std::endl;
<br> }
<br> } lv;
<br> }
<br>};
<br>
<br>int main()
<br>{
<br> MyGC m;
<br> m.f();
<br>}
<br></blockquote></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_354_424693517.1414089970698--
.
Author: Thiago Macieira <thiago@macieira.org>
Date: Thu, 23 Oct 2014 11:50:29 -0700
Raw View
On Thursday 23 October 2014 11:44:36 oliver.j.nadler@gmail.com wrote:
> #include <iostream>
>
> struct MyGC{
> struct variables{
> int a=42,b=666,c=99;
> };
>
> void f(){
> using variables as_namespace;
> std::cout << "a is " << a << ", b is " << b << ", c is" << c << std
>
> ::endl;
>
> }
> };
>
> int main(){
> MyGC m;
> m.f();
> }
Where's the object that contains variables::a, variables::b and variables::c?
It isn't the MyGC object, since it's an empty struct.
--
Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
Software Architect - Intel Open Source Technology Center
PGP/GPG: 0x6EF45358; fingerprint:
E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
--
---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
.
Author: contact@ncomputers.org
Date: Thu, 23 Oct 2014 11:58:57 -0700 (PDT)
Raw View
------=_Part_497_2024314246.1414090737095
Content-Type: text/plain; charset=UTF-8
Thiago,
It is as_namespace;
using variables as_namespace;
It can have every name:
using className objectName;
It would be also possible to use its namespace, without declaring it after
the using word, for example:
{
className objectName;
{
using objectName;
}
}
And you gave me also a new idea: allow to use the namespace of objects
created with the *new* operator too.
{
myClass * myObject = new myClass();
using * myObject;
//Namespace of myObject is visible
//Instead of writing myObject -> variable;
//It would be possible to only write:
variable = 1;
delete myObject;//It can cause:
variable = 1; //Undefined behaviour
}
PF, ncomputers.org
Am Donnerstag, 23. Oktober 2014 13:50:35 UTC-5 schrieb Thiago Macieira:
>
> On Thursday 23 October 2014 11:44:36 oliver....@gmail.com <javascript:>
> wrote:
> > #include <iostream>
> >
> > struct MyGC{
> > struct variables{
> > int a=42,b=666,c=99;
> > };
> >
> > void f(){
> > using variables as_namespace;
> > std::cout << "a is " << a << ", b is " << b << ", c is" << c <<
> std
> >
> > ::endl;
> >
> > }
> > };
> >
> > int main(){
> > MyGC m;
> > m.f();
> > }
>
> Where's the object that contains variables::a, variables::b and
> variables::c?
>
> It isn't the MyGC object, since it's an empty struct.
> --
> Thiago Macieira - thiago (AT) macieira.info - thiago (AT) kde.org
> Software Architect - Intel Open Source Technology Center
> PGP/GPG: 0x6EF45358; fingerprint:
> E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4 5358
>
>
--
---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_497_2024314246.1414090737095
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Thiago,<br><br>It is as_namespace;<br><br><div class=3D"pr=
ettyprint" style=3D"background-color: rgb(250, 250, 250); border-color: rgb=
(187, 187, 187); border-style: solid; border-width: 1px; word-wrap: break-w=
ord;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=
=3D"color: #008;" class=3D"styled-by-prettify">using</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> variables as_namespace</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br></span></div></code></di=
v><br>It can have every name:<br><br><div class=3D"prettyprint" style=3D"ba=
ckground-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); borde=
r-style: solid; border-width: 1px; word-wrap: break-word;"><code class=3D"p=
rettyprint"><div class=3D"subprettyprint"><span style=3D"color: #008;" clas=
s=3D"styled-by-prettify">using</span><span style=3D"color: #000;" class=3D"=
styled-by-prettify"> className objectName</span><span style=3D"color: #660;=
" class=3D"styled-by-prettify">;</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br></span></div></code></div><br>It would be also =
possible to use its namespace, without declaring it after the <span style=
=3D"background-color: rgb(238, 238, 238);"><span style=3D"font-family: cour=
ier new,monospace;">using</span></span> word, for example:<br><br><div clas=
s=3D"prettyprint" style=3D"background-color: rgb(250, 250, 250); border-col=
or: rgb(187, 187, 187); border-style: solid; border-width: 1px; word-wrap: =
break-word;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br> className =
objectName</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> =
</span><span style=3D"color: #008;" class=3D"styled-b=
y-prettify">using</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> objectName</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><=
br> </span><span style=3D"color: #660;" class=3D"styled-by-pre=
ttify">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><b=
r></span><span style=3D"color: #660;" class=3D"styled-by-prettify">}</span>=
<span style=3D"color: #000;" class=3D"styled-by-prettify"><br></span></div>=
</code></div><br>And you gave me also a new idea: allow to use the namespac=
e of objects created with the <span style=3D"background-color: rgb(238, 238=
, 238);"><b>new</b></span> operator too.<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: =
#660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"><br> myClass </span><span style=3D"=
color: #660;" class=3D"styled-by-prettify">*</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> myObject </span><span style=3D"color: #6=
60;" class=3D"styled-by-prettify">=3D</span><span style=3D"color: #000;" cl=
ass=3D"styled-by-prettify"> </span><span style=3D"color: #008;" class=3D"st=
yled-by-prettify">new</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> myClass</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><span style=3D"color: #008;" class=3D"styled-by-=
prettify">using</span><span style=3D"color: #000;" class=3D"styled-by-prett=
ify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">*</s=
pan><span style=3D"color: #000;" class=3D"styled-by-prettify"> myObject</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"><br> </spa=
n><span style=3D"color: #800;" class=3D"styled-by-prettify">//Namespace of =
myObject is visible</span><span style=3D"color: #000;" class=3D"styled-by-p=
rettify"><br> </span><span style=3D"color: #800;" class=3D"sty=
led-by-prettify">//Instead of writing myObject -> variable;</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"><br> </spa=
n><span style=3D"color: #800;" class=3D"styled-by-prettify">//It would be p=
ossible to only write:</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"><br> variable </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"style=
d-by-prettify">1</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">;</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br=
> </span><span style=3D"color: #008;" class=3D"styled-by-prett=
ify">delete</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
> myObject</span><span style=3D"color: #660;" class=3D"styled-by-prettify">=
;</span><span style=3D"color: #800;" class=3D"styled-by-prettify">//It can =
cause:</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
variable </span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">=3D</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #066;" class=3D"styled-by-prettify">1</=
span><span style=3D"color: #660;" class=3D"styled-by-prettify">;</span><spa=
n style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span =
style=3D"color: #800;" class=3D"styled-by-prettify">//Undefined behaviour</=
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 styl=
e=3D"color: #000;" class=3D"styled-by-prettify"><br></span></div></code></d=
iv><br>PF, ncomputers.org<br><br>Am Donnerstag, 23. Oktober 2014 13:50:35 U=
TC-5 schrieb Thiago Macieira:<blockquote class=3D"gmail_quote" style=3D"mar=
gin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;">O=
n Thursday 23 October 2014 11:44:36 <a href=3D"javascript:" target=3D"_blan=
k" gdf-obfuscated-mailto=3D"_r6yemiKOskJ" onmousedown=3D"this.href=3D'javas=
cript:';return true;" onclick=3D"this.href=3D'javascript:';return true;">ol=
iver....@gmail.com</a> wrote:
<br>> #include <iostream>
<br>>=20
<br>> struct MyGC{
<br>> struct variables{
<br>> int a=3D42,b=3D666,c=3D99;
<br>> };
<br>>=20
<br>> void f(){
<br>> using variables as_namespace;
<br>> std::cout << "a is " << a =
<< ", b is " << b << ", c is" << c << std
<br>>=20
<br>> ::endl;
<br>>=20
<br>> }
<br>> };
<br>>=20
<br>> int main(){
<br>> MyGC m;
<br>> m.f();
<br>> }
<br>
<br>Where's the object that contains variables::a, variables::b and variabl=
es::c?
<br>
<br>It isn't the MyGC object, since it's an empty struct.
<br>--=20
<br>Thiago Macieira - thiago (AT) <a href=3D"http://macieira.info" target=
=3D"_blank" onmousedown=3D"this.href=3D'http://www.google.com/url?q\75http%=
3A%2F%2Fmacieira.info\46sa\75D\46sntz\0751\46usg\75AFQjCNEswDUBNCNanbu7euhq=
Ln_62FW8ag';return true;" onclick=3D"this.href=3D'http://www.google.com/url=
?q\75http%3A%2F%2Fmacieira.info\46sa\75D\46sntz\0751\46usg\75AFQjCNEswDUBNC=
Nanbu7euhqLn_62FW8ag';return true;">macieira.info</a> - thiago (AT) <a href=
=3D"http://kde.org" target=3D"_blank" onmousedown=3D"this.href=3D'http://ww=
w.google.com/url?q\75http%3A%2F%2Fkde.org\46sa\75D\46sntz\0751\46usg\75AFQj=
CNHGRJdo5_JYG1DowztwAHAKs80XSA';return true;" onclick=3D"this.href=3D'http:=
//www.google.com/url?q\75http%3A%2F%2Fkde.org\46sa\75D\46sntz\0751\46usg\75=
AFQjCNHGRJdo5_JYG1DowztwAHAKs80XSA';return true;">kde.org</a>
<br> Software Architect - Intel Open Source Technology Center
<br> PGP/GPG: 0x6EF45358; fingerprint:
<br> E067 918B B660 DBD1 105C 966C 33F5 F005 6EF4=
5358
<br>
<br></blockquote></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_497_2024314246.1414090737095--
.
Author: Ville Voutilainen <ville.voutilainen@gmail.com>
Date: Thu, 23 Oct 2014 22:01:28 +0300
Raw View
On 23 October 2014 21:58, <contact@ncomputers.org> wrote:
> And you gave me also a new idea: allow to use the namespace of objects
> created with the new operator too.
>
> {
> myClass * myObject = new myClass();
> using * myObject;
> //Namespace of myObject is visible
> //Instead of writing myObject -> variable;
> //It would be possible to only write:
> variable = 1;
> delete myObject;//It can cause:
> variable = 1; //Undefined behaviour
> }
Well, this looks a lot like a with-statement in pascal. Suggestions to
add such a thing
to C++ have been rejected before.
What I suggested gives you a work-around that avoids having to repeat
all the variable
declarations, at the cost of some remaining boiler-plate. Removing
that remaining boiler-plate
requires a macro.
--
---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
.
Author: contact@ncomputers.org
Date: Thu, 23 Oct 2014 12:10:40 -0700 (PDT)
Raw View
------=_Part_427_428793714.1414091440778
Content-Type: text/plain; charset=UTF-8
Ville,
Well, this looks a lot like a with-statement in pascal. Suggestions to
> add such a thing
> to C++ have been rejected before.
Ohh! Yes! I remember it! It is also possible in Visual Basic! If it is
possible in two other programming languages, why isn't it in C++?
If it were proposed before, this could be a reason to consider it again!
Someone without relationship to the one, who proposed this before, is
proposing it again, what can suggest, that this proposal should be
implemented.
What I suggested gives you a work-around that avoids having to repeat
> all the variable
> declarations, at the cost of some remaining boiler-plate. Removing
> that remaining boiler-plate
> requires a macro.
Yes, I recognize it! It is a good solution. I would maybe use it one day.
For now I prefer to redeclare all variables, it depends only on my
programming style.
at the cost of some remaining boiler-plate. Removing
> that remaining boiler-plate
> requires a macro.
To reduce costs of computer codes could help us to make better programs.
Thank you very much!
PF, ncomputers.org
Am Donnerstag, 23. Oktober 2014 14:01:30 UTC-5 schrieb Ville Voutilainen:
>
> On 23 October 2014 21:58, <con...@ncomputers.org <javascript:>> wrote:
> > And you gave me also a new idea: allow to use the namespace of objects
> > created with the new operator too.
> >
> > {
> > myClass * myObject = new myClass();
> > using * myObject;
> > //Namespace of myObject is visible
> > //Instead of writing myObject -> variable;
> > //It would be possible to only write:
> > variable = 1;
> > delete myObject;//It can cause:
> > variable = 1; //Undefined behaviour
> > }
>
>
> Well, this looks a lot like a with-statement in pascal. Suggestions to
> add such a thing
> to C++ have been rejected before.
>
> What I suggested gives you a work-around that avoids having to repeat
> all the variable
> declarations, at the cost of some remaining boiler-plate. Removing
> that remaining boiler-plate
> requires a macro.
>
--
---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_427_428793714.1414091440778
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Ville,<br><br><blockquote style=3D"margin: 0px 0px 0px 0.8=
ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class=3D=
"gmail_quote">Well, this looks a lot like a with-statement in pascal. Sugge=
stions to
<br>add such a thing
<br>to C++ have been rejected before.
</blockquote><div><br>Ohh! Yes! I remember it! It is also possible in Visua=
l Basic! If it is possible in two other programming languages, why isn't it=
in C++?<br><br>If it were proposed before, this could be a reason to consi=
der it again! Someone without relationship to the one, who proposed this be=
fore, is proposing it again, what can suggest, that this proposal should be=
implemented.<br><br><blockquote style=3D"margin: 0px 0px 0px 0.8ex; border=
-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class=3D"gmail_quo=
te">What I suggested gives you a work-around that avoids having to repeat
<br>all the variable
<br>declarations, at the cost of some remaining boiler-plate. Removing
<br>that remaining boiler-plate
<br>requires a macro.
</blockquote><div><br>Yes, I recognize it! It is a good solution. I would m=
aybe use it one day. For now I prefer to redeclare all variables, it depend=
s only on my programming style.<br><br><blockquote style=3D"margin: 0px 0px=
0px 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" =
class=3D"gmail_quote">at the cost of some remaining boiler-plate. Removing
<br>that remaining boiler-plate
<br>requires a macro.
</blockquote><br>To reduce costs of computer codes could help us to make be=
tter programs.<br></div></div><br><pre wrap=3D"">Thank you very much!<br><b=
r>PF, ncomputers.org<br></pre><br>Am Donnerstag, 23. Oktober 2014 14:01:30 =
UTC-5 schrieb Ville Voutilainen:<blockquote class=3D"gmail_quote" style=3D"=
margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;=
">On 23 October 2014 21:58, <<a href=3D"javascript:" target=3D"_bl=
ank" gdf-obfuscated-mailto=3D"4avTblPiW68J" onmousedown=3D"this.href=3D'jav=
ascript:';return true;" onclick=3D"this.href=3D'javascript:';return true;">=
con...@ncomputers.org</a>> wrote:
<br>> And you gave me also a new idea: allow to use the namespace of obj=
ects
<br>> created with the new operator too.
<br>>
<br>> {
<br>> myClass * myObject =3D new myClass();
<br>> using * myObject;
<br>> //Namespace of myObject is visible
<br>> //Instead of writing myObject -> variable;
<br>> //It would be possible to only write:
<br>> variable =3D 1;
<br>> delete myObject;//It can cause:
<br>> variable =3D 1; //Undefined behaviour
<br>> }
<br>
<br>
<br>Well, this looks a lot like a with-statement in pascal. Suggestions to
<br>add such a thing
<br>to C++ have been rejected before.
<br>
<br>What I suggested gives you a work-around that avoids having to repeat
<br>all the variable
<br>declarations, at the cost of some remaining boiler-plate. Removing
<br>that remaining boiler-plate
<br>requires a macro.
<br></blockquote></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_427_428793714.1414091440778--
.
Author: Yuriy Smirnov <neoprogramming@gmail.com>
Date: Sun, 7 Dec 2014 11:15:16 -0800 (PST)
Raw View
------=_Part_3515_347910018.1417979716109
Content-Type: multipart/alternative;
boundary="----=_Part_3516_1873185392.1417979716109"
------=_Part_3516_1873185392.1417979716109
Content-Type: text/plain; charset=UTF-8
It's good idea. For example, basic window classes in libraries like MFC,
Qt, wxWidgets etc (CWnd, QWidget...) contain hundreds of methods. It would
be logical to group them according by internal namespaces.
>
>
--
---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_3516_1873185392.1417979716109
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">It's good idea. For example, basic window classes in libra=
ries like MFC, Qt, wxWidgets etc (CWnd, QWidget...) contain hundreds of met=
hods. It would be logical to group them according by internal namespac=
es.<br><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"><code>=
<br></code></div></blockquote></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_3516_1873185392.1417979716109--
------=_Part_3515_347910018.1417979716109--
.
Author: Sean Middleditch <sean.middleditch@gmail.com>
Date: Sun, 7 Dec 2014 13:34:30 -0800 (PST)
Raw View
------=_Part_2532_1883400699.1417988070955
Content-Type: multipart/alternative;
boundary="----=_Part_2533_406591313.1417988070955"
------=_Part_2533_406591313.1417988070955
Content-Type: text/plain; charset=UTF-8
On Sunday, December 7, 2014 11:15:16 AM UTC-8, Yuriy Smirnov wrote:
>
> It's good idea. For example, basic window classes in libraries like MFC,
> Qt, wxWidgets etc (CWnd, QWidget...) contain hundreds of methods. It would
> be logical to group them according by internal namespaces.
>
>>
>>
I would argue that these classes are just poorly designed and seriously
fail at the SRP (single responsibility principle). It's an unfortunately
common problem for a lot of these GUI libraries that were originally
designed in the 90's.
You can use a component-based GUI system and not only get the benefits of
this feature but also get a ton of other benefits. As an easily-accessible
example, consider a GUI system like Unity3D 4.6's new open-source GUI
library. Each individual class is small and fairly self-contained, easy to
maintain, the whole architecture is super flexible for designers, efficient
enough for real-time games, and works well with different paradigms like
MVC, MVVM, FRP, etc. Point being that a major new language feature needs a
far better use case than some bad legacy code.
--
---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_2533_406591313.1417988070955
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">On Sunday, December 7, 2014 11:15:16 AM UTC-8, Yuriy Smirn=
ov 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">It's=
good idea. For example, basic window classes in libraries like MFC, Qt, wx=
Widgets etc (CWnd, QWidget...) contain hundreds of methods. It would b=
e logical to group them according by internal namespaces.<br><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"><code><br></code></div></blockqu=
ote></div></blockquote><div><br></div>I would argue that these classes are =
just poorly designed and seriously fail at the SRP (single responsibility p=
rinciple). It's an unfortunately common problem for a lot of these GUI libr=
aries that were originally designed in the 90's.<div><br></div><div>You can=
use a component-based GUI system and not only get the benefits of this fea=
ture but also get a ton of other benefits. As an easily-accessible example,=
consider a GUI system like Unity3D 4.6's new open-source GUI library. Each=
individual class is small and fairly self-contained, easy to maintain, the=
whole architecture is super flexible for designers, efficient enough for r=
eal-time games, and works well with different paradigms like MVC, MVVM, FRP=
, etc. Point being that a major new language feature needs a far better use=
case than some bad legacy code.</div><div> <br></div></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_2533_406591313.1417988070955--
------=_Part_2532_1883400699.1417988070955--
.
Author: David Krauss <potswa@gmail.com>
Date: Mon, 8 Dec 2014 12:27:04 +0800
Raw View
--Apple-Mail=_175BEAF7-13BA-4652-86CE-3C61C08DBCC3
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain; charset=UTF-8
> On 2014=E2=80=9312=E2=80=9308, at 5:34 AM, Sean Middleditch <sean.middled=
itch@gmail.com> wrote:
>=20
> I would argue that these classes are just poorly designed and seriously f=
ail at the SRP (single responsibility principle). It's an unfortunately com=
mon problem for a lot of these GUI libraries that were originally designed =
in the 90's.
Another solution may be to allow member using declarations to refer to name=
space-scope (free) functions.
Stroustrup also made a proposal in Urbana that namespace-scope functions sh=
ould be callable using member access syntax. It was recommended for further=
study.
The problem of refactoring code based on =E2=80=9Cgod classes=E2=80=9D is b=
eing tackled already, without introducing new constructs such as in-class n=
amespaces which may further complicate the language.
--=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
--Apple-Mail=_175BEAF7-13BA-4652-86CE-3C61C08DBCC3
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=UTF-8
<html><head><meta http-equiv=3D"Content-Type" content=3D"text/html charset=
=3Dutf-8"></head><body style=3D"word-wrap: break-word; -webkit-nbsp-mode: s=
pace; -webkit-line-break: after-white-space;" class=3D""><br class=3D""><di=
v><blockquote type=3D"cite" class=3D""><div class=3D"">On 2014=E2=80=9312=
=E2=80=9308, at 5:34 AM, Sean Middleditch <<a href=3D"mailto:sean.middle=
ditch@gmail.com" class=3D"">sean.middleditch@gmail.com</a>> wrote:</div>=
<br class=3D"Apple-interchange-newline"><div class=3D""><span style=3D"font=
-family: Helvetica; font-size: 12px; font-style: normal; font-variant: norm=
al; font-weight: normal; letter-spacing: normal; line-height: normal; orpha=
ns: auto; text-align: start; text-indent: 0px; text-transform: none; white-=
space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: =
0px; float: none; display: inline !important;" class=3D"">I would argue tha=
t these classes are just poorly designed and seriously fail at the SRP (sin=
gle responsibility principle). It's an unfortunately common problem for a l=
ot of these GUI libraries that were originally designed in the 90's.</span>=
<br class=3D"Apple-interchange-newline"></div></blockquote></div><br class=
=3D""><div class=3D"">Another solution may be to allow member <font face=3D=
"Courier" class=3D"">using</font> declarations to refer to namespace-scope =
(free) functions.</div><div class=3D""><br class=3D""></div><div class=3D""=
>Stroustrup also made a proposal in Urbana that namespace-scope functions s=
hould be callable using member access syntax. It was recommended for furthe=
r study.</div><div class=3D""><br class=3D""></div><div class=3D"">The prob=
lem of refactoring code based on =E2=80=9Cgod classes=E2=80=9D is being tac=
kled already, without introducing new constructs such as in-class namespace=
s which may further complicate the language.</div></body></html>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
--Apple-Mail=_175BEAF7-13BA-4652-86CE-3C61C08DBCC3--
.
Author: Izzy Coding <matthew.i.greenwood@gmail.com>
Date: Mon, 8 Dec 2014 02:34:25 -0800 (PST)
Raw View
------=_Part_106_510146736.1418034865656
Content-Type: multipart/alternative;
boundary="----=_Part_107_1281473128.1418034865657"
------=_Part_107_1281473128.1418034865657
Content-Type: text/plain; charset=UTF-8
I agree with Sean Middleditch.
Most of these problems are found in legacy libraries from way back when
that was the right thing to do (or at least the only thing to do).
In all my work I already nest namespaces in order to cleanup my working
environment.
The following is already possible (In Visual Studio at least):
namespace A {
namespace B {
class C {
/* class definition */
};
}
}
A::B::C varname{};
I usually use this along with using directive to import relevant things
into a manually created namespace for use in my general perpose code.
--
---
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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposals/.
------=_Part_107_1281473128.1418034865657
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">I agree with Sean Middleditch.<br>Most of these problems a=
re found in legacy libraries from way back when that was the right thing to=
do (or at least the only thing to do).<br><br>In all my work I already nes=
t namespaces in order to cleanup my working environment.<br><br>The followi=
ng is already possible (In Visual Studio at least):<br><br><div class=3D"pr=
ettyprint" style=3D"background-color: rgb(250, 250, 250); border-color: rgb=
(187, 187, 187); border-style: solid; border-width: 1px; word-wrap: break-w=
ord;"><code class=3D"prettyprint"><div class=3D"subprettyprint"><span style=
=3D"color: #008;" class=3D"styled-by-prettify">namespace</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"> A </span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify"><br> </span><span style=3D"colo=
r: #008;" class=3D"styled-by-prettify">namespace</span><span style=3D"color=
: #000;" class=3D"styled-by-prettify"> B </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">class</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> C </span><span style=3D"color: #=
660;" class=3D"styled-by-prettify">{</span><span style=3D"color: #000;" cla=
ss=3D"styled-by-prettify"><br> </s=
pan><span style=3D"color: #800;" class=3D"styled-by-prettify">/* class defi=
nition */</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: #660;" class=3D=
"styled-by-prettify">}</span><span style=3D"color: #000;" class=3D"styled-b=
y-prettify"><br></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>A</span><span style=3D"color: #660;" class=3D"styled-by-prettify">::</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify">B</span><spa=
n style=3D"color: #660;" class=3D"styled-by-prettify">::</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify">C varname</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">{};</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"><br></span></div></code></div><br>I=
usually use this along with using directive to import relevant things into=
a manually created namespace for use in my general perpose code.<br></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_107_1281473128.1418034865657--
------=_Part_106_510146736.1418034865656--
.
Author: ajaykumarc137151@gmail.com
Date: Wed, 14 Jan 2015 09:47:42 -0800 (PST)
Raw View
------=_Part_26_1136541060.1421257662528
Content-Type: multipart/alternative;
boundary="----=_Part_27_2126039002.1421257662528"
------=_Part_27_2126039002.1421257662528
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Hello sir, I have made ashort note on this namespace topic with examples=
=20
that may give u clarity abt these things. I hope it will be helpful for u..=
=20
On Tuesday, October 21, 2014 at 8:25:26 AM UTC+5:30, David Rodr=C3=ADguez I=
beas=20
wrote:
>
> Personally I prefer to have variables live in the smallest scope possible=
=20
> as it makes reasoning about the code simpler to the programmer. It also=
=20
> makes it simpler for an optimizer to reason about the lifetime of the=20
> variables and often helps with optimizations.
>
> From the description it is not clear to me whether you want to have=20
> separate subgroups of members (whose lifetime is still controlled by the=
=20
> lifetime of the complete object) or else you just want this as a shorthan=
d=20
> not to have to create the separate variables. For the former there is no=
=20
> ideal solution, but I have not faced that as a problem that is not solved=
=20
> with refactoring. If it is the latter, it is simpler and better to make=
=20
> the variables local to each function.
>
> David
>
> On Mon, Oct 20, 2014 at 6:58 PM, <con...@ncomputers.org <javascript:>>=20
> wrote:
>
>> I recognize that I don't have neither the enough experience and the=20
>> enough knowledge to write a proposal with high probabilities to become=
=20
>> standard and to be considered seriously by the international ISO/ANSI C+=
+=20
>> committee.
>>
>> But I come here, I come to you as a customer. I am a customer of the=20
>> ISO/ANSI C++ programming language, because I use it. I write computer co=
des=20
>> using this language. I consume its words. I come here and share my=20
>> suggestions with the intention to improve the product, the amazing C++=
=20
>> programming language.
>>
>> Because if the ISO/ANSI C++ committee's erudites (all of you), decide to=
=20
>> act as provider and hear me as a customer, you can gain some ideas to=20
>> improve the product, the C++ programming language. To improve it could e=
ase=20
>> the life not only of the programmers while they write codes consuming it=
s=20
>> words, but also of every living being of the earth, because technology i=
s=20
>> today a very important support of our lifes.
>>
>> For your comments, your time, your patience and your help, that at the=
=20
>> end become contributions, which I want to turn into solutions: I am=20
>> infinite thankful to all of you!
>>
>> Nested namespaces by classes It is possible to nest a namespace inside=
=20
>> another namespace.
>>
>> Classes, structs and unions are also namespaces, despite they have other=
=20
>> purpose.
>>
>> Theoretically it should be possible to nest namespaces inside classes,=
=20
>> structs and unions, what could be very useful.
>>
>> *For example:*
>>
>> When several class members require the same variables, it could be usefu=
l=20
>> for the programmer to use *nested namespaces* to avoid the=20
>> re-declaration of the same variables.
>>
>> It can also help compilers to optimize the code.
>>
>> Personally I like to avoid the re-declaration of the same variables=20
>> inside different scopes, because sometimes they are too much.
>>
>> I don't like either let them easily accessible.
>>
>> When it is easy to access them, it is possible to use them accidentally,=
=20
>> what can cause problems, which sometimes require hours to find, because=
=20
>> they are hard to see.
>>
>> Without *nested namespaces by classes*, I do prefer to re-declare the=20
>> same variables inside each scope to avoid confusions, despite it is an=
=20
>> avoidable tedious task.
>>
>> On these cases, it would be easier to write: using namespace name;=20
>> inside the scope than to re-declare the same variables again.
>>
>> It would also ease the identifying of scopes with shared variables.
>>
>> Other reason to suggest this improvement is that it would allow to mix *=
nested=20
>> namespaces* with templates.
>>
>> *Downloads: *nested namespaces classes.cpp=20
>> <http://ncomputers.org/download/code/suggestions/nested%20namespaces%20c=
lasses.cpp>
>>
>> template<typename Typename>
>> struct Struct{
>> namespace shared{
>> Typename variable;
>> }
>> =20
>> Struct():
>> shared::variable(0)
>> {}
>> =20
>> void Function_1(){
>> //shared variable is visible
>> using namespace shared;
>> }
>> =20
>> void Function_2(){
>> //use special variable
>> int variable;
>> }
>> =20
>> void Function_3(){
>> {
>> //shared variable is visible
>> using namespace shared;
>> }
>> //use special variable
>> int variable;
>> }
>> };=20
>>
>> Last modified: 2014 - Oct - 20=20
>>
>> --=20
>>
>> ---=20
>> You received this message because you are subscribed to the Google Group=
s=20
>> "ISO C++ Standard - Future Proposals" group.
>> To unsubscribe from this group and stop receiving emails from it, send a=
n=20
>> email to std-proposal...@isocpp.org <javascript:>.
>> To post to this group, send email to std-pr...@isocpp.org <javascript:>.
>> Visit this group at=20
>> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>>
>
>
--=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
------=_Part_27_2126039002.1421257662528
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr">Hello sir, I have made ashort note on this namespace topic=
with examples that may give u clarity abt these things. I hope it wi=
ll be helpful for u.. <br><br>On Tuesday, October 21, 2014 at 8:25:26 AM UT=
C+5:30, David Rodr=C3=ADguez Ibeas wrote:<blockquote class=3D"gmail_quote" =
style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-l=
eft: 1ex;"><div dir=3D"ltr">Personally I prefer to have variables live in t=
he smallest scope possible as it makes reasoning about the code simpler to =
the programmer. It also makes it simpler for an optimizer to reason about t=
he lifetime of the variables and often helps with optimizations.<div><br></=
div><div>From the description it is not clear to me whether you want to hav=
e separate subgroups of members (whose lifetime is still controlled by the =
lifetime of the complete object) or else you just want this as a shorthand =
not to have to create the separate variables. For the former there is no id=
eal solution, but I have not faced that as a problem that is not solved wit=
h refactoring. If it is the latter, it is simpler and better to make =
the variables local to each function.</div><div><br></div><div>  =
; David</div></div><div><br><div class=3D"gmail_quote">On Mon, Oct 20, 2014=
at 6:58 PM, <span dir=3D"ltr"><<a href=3D"javascript:" target=3D"_blan=
k" gdf-obfuscated-mailto=3D"7IXaZB4G5_kJ" onmousedown=3D"this.href=3D'javas=
cript:';return true;" onclick=3D"this.href=3D'javascript:';return true;">co=
n...@ncomputers.org</a>></span> wrote:<br><blockquote class=3D"gmail_quo=
te" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"=
><div dir=3D"ltr">I recognize that I don't have neither the enough experien=
ce and the enough knowledge to write a proposal with high probabilities to =
become standard and to be considered seriously by the international ISO/ANS=
I C++ committee.<br><br>But I come here, I come to you as a customer. I am =
a customer of the ISO/ANSI C++ programming language, because I use it. I wr=
ite computer codes using this language. I consume its words. I come here an=
d share my suggestions with the intention to improve the product, the amazi=
ng C++ programming language.<br><br>Because if the ISO/ANSI C++ committee's=
erudites (all of you), decide to act as provider and hear me as a customer=
, you can gain some ideas to improve the product, the C++ programming langu=
age. To improve it could ease the life not only of the programmers while th=
ey write codes consuming its words, but also of every living being of the e=
arth, because technology is today a very important support of our lifes.<br=
><br>For your comments, your time, your patience and your help, that at the=
end become contributions, which I want to turn into solutions: I am infini=
te thankful to all of you!<br><br><h1>Nested namespaces by classes</h1>
It is possible to nest a namespace inside another namespace.<br><br>
Classes, structs and unions are also namespaces, despite they have other pu=
rpose.<br><br>
Theoretically it should be possible to nest namespaces inside classes, stru=
cts and unions, what could be very useful.<br><br>
<b>For example:</b><br><br>
When several class members require the same variables, it could be useful f=
or the programmer to use <b>nested namespaces</b> to avoid the re-declarati=
on of the same variables.<br><br>
It can also help compilers to optimize the code.<br><br>
Personally I like to avoid the re-declaration of the same variables=20
inside different scopes, because sometimes they are too much.<br><br>
I don't like either let them easily accessible.<br><br>
When it is easy to access them, it is possible to use them accidentally,
what can cause problems, which sometimes require hours to find, because
they are hard to see.<br><br>
Without <b>nested namespaces by classes</b>, I do prefer to re-declare the =
same variables inside each scope to avoid confusions, despite it is an avoi=
dable tedious task.<br><br>
On these cases, it would be easier to write: <code><span>using namespace</s=
pan> name;</code> inside the scope than to re-declare the same variables ag=
ain.<br><br>
It would also ease the identifying of scopes with shared variables.<br><br>
Other reason to suggest this improvement is that it would allow to mix <b>n=
ested namespaces</b> with templates.<br><br>
<b>Downloads: </b><a href=3D"http://ncomputers.org/download/code/suggestion=
s/nested%20namespaces%20classes.cpp" target=3D"_blank" onmousedown=3D"this.=
href=3D'http://www.google.com/url?q\75http%3A%2F%2Fncomputers.org%2Fdownloa=
d%2Fcode%2Fsuggestions%2Fnested%2520namespaces%2520classes.cpp\46sa\75D\46s=
ntz\0751\46usg\75AFQjCNEZabyug6p8MPgpL6s37p1twRGfRA';return true;" onclick=
=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fncomputers.org%=
2Fdownload%2Fcode%2Fsuggestions%2Fnested%2520namespaces%2520classes.cpp\46s=
a\75D\46sntz\0751\46usg\75AFQjCNEZabyug6p8MPgpL6s37p1twRGfRA';return true;"=
>nested namespaces classes.cpp</a><br><br>
<u></u><code>
<div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,18=
7);border-style:solid;border-width:1px;word-wrap:break-word"><code><div><sp=
an style=3D"color:#008">template</span><span style=3D"color:#660"><</spa=
n><span style=3D"color:#008">typename</span><span style=3D"color:#000"> </s=
pan><span style=3D"color:#606">Typename</span><span style=3D"color:#660">&g=
t;</span><span style=3D"color:#000"><br></span><span style=3D"color:#008">s=
truct</span><span style=3D"color:#000"> </span><span style=3D"color:#606">S=
truct</span><span style=3D"color:#660">{</span><span style=3D"color:#000"><=
br> </span><span style=3D"color:#008">namespace</span><s=
pan style=3D"color:#000"> shared</span><span style=3D"color:#660">{</span><=
span style=3D"color:#000"><br> </span><spa=
n style=3D"color:#606">Typename</span><span style=3D"color:#000"> variable<=
/span><span style=3D"color:#660">;</span><span style=3D"color:#000"><br>&nb=
sp; </span><span style=3D"color:#660">}</span><span style=3D"c=
olor:#000"><br> <br> </span><span style=3D"color:#6=
06">Struct</span><span style=3D"color:#660">():</span><span style=3D"color:=
#000"><br> shared</span><span style=3D"col=
or:#660">::</span><span style=3D"color:#000">variable</span><span style=3D"=
color:#660">(</span><span style=3D"color:#066">0</span><span style=3D"color=
:#660">)</span><span style=3D"color:#000"><br> </span><s=
pan style=3D"color:#660">{}</span><span style=3D"color:#000"><br> <br>=
</span><span style=3D"color:#008">void</span><span styl=
e=3D"color:#000"> </span><span style=3D"color:#606">Function_1</span><span =
style=3D"color:#660">(){</span><span style=3D"color:#000"><br> =
</span><span style=3D"color:#800">//shared variable is=
visible</span><span style=3D"color:#000"><br> &=
nbsp;</span><span style=3D"color:#008">using</span><span style=3D"color:#00=
0"> </span><span style=3D"color:#008">namespace</span><span style=3D"color:=
#000"> shared</span><span style=3D"color:#660">;</span><span style=3D"color=
:#000"><br> </span><span style=3D"color:#660">}</span><s=
pan style=3D"color:#000"><br> <br> </span><span sty=
le=3D"color:#008">void</span><span style=3D"color:#000"> </span><span style=
=3D"color:#606">Function_2</span><span style=3D"color:#660">(){</span><span=
style=3D"color:#000"><br> </span><span st=
yle=3D"color:#800">//use special variable</span><span style=3D"color:#000">=
<br> </span><span style=3D"color:#008">int=
</span><span style=3D"color:#000"> variable</span><span style=3D"color:#660=
">;</span><span style=3D"color:#000"><br> </span><span s=
tyle=3D"color:#660">}</span><span style=3D"color:#000"><br> <br> =
</span><span style=3D"color:#008">void</span><span style=3D"c=
olor:#000"> </span><span style=3D"color:#606">Function_3</span><span style=
=3D"color:#660">(){</span><span style=3D"color:#000"><br> &nbs=
p; </span><span style=3D"color:#660">{</span><span style=3D"co=
lor:#000"><br> </span><span =
style=3D"color:#800">//shared variable is visible</span><span style=3D"colo=
r:#000"><br> </span><span st=
yle=3D"color:#008">using</span><span style=3D"color:#000"> </span><span sty=
le=3D"color:#008">namespace</span><span style=3D"color:#000"> shared</span>=
<span style=3D"color:#660">;</span><span style=3D"color:#000"><br> &n=
bsp; </span><span style=3D"color:#660">}</span><span st=
yle=3D"color:#000"><br> </span><span style=
=3D"color:#800">//use special variable</span><span style=3D"color:#000"><br=
> </span><span style=3D"color:#008">int</s=
pan><span style=3D"color:#000"> variable</span><span style=3D"color:#660">;=
</span><span style=3D"color:#000"><br></span><span style=3D"color:#000">&nb=
sp; </span><span style=3D"color:#660">}</span><span style=3D"c=
olor:#000"><br></span><span style=3D"color:#660">};</span><span style=3D"co=
lor:#000"> </span></div></code></div><br></code><u></u>Last modified: 2014 =
- Oct - 20 <br></div><span><font color=3D"#888888">
<p></p>
-- <br>
<br>
--- <br>
You received this message because you are subscribed to the Google Groups "=
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"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"=
7IXaZB4G5_kJ" onmousedown=3D"this.href=3D'javascript:';return true;" onclic=
k=3D"this.href=3D'javascript:';return true;">std-proposal...@<wbr>isocpp.or=
g</a>.<br>
To post to this group, send email to <a href=3D"javascript:" target=3D"_bla=
nk" gdf-obfuscated-mailto=3D"7IXaZB4G5_kJ" onmousedown=3D"this.href=3D'java=
script:';return true;" onclick=3D"this.href=3D'javascript:';return true;">s=
td-pr...@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank" onmousedown=3D"this.href=3D'http://groups=
..google.com/a/isocpp.org/group/std-proposals/';return true;" onclick=3D"thi=
s.href=3D'http://groups.google.com/a/isocpp.org/group/std-proposals/';retur=
n true;">http://groups.google.com/a/<wbr>isocpp.org/group/std-<wbr>proposal=
s/</a>.<br>
</font></span></blockquote></div><br></div>
</blockquote></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_27_2126039002.1421257662528--
------=_Part_26_1136541060.1421257662528--
.
Author: ajaykumarc137151@gmail.com
Date: Wed, 14 Jan 2015 09:53:47 -0800 (PST)
Raw View
------=_Part_50_1431986723.1421258027137
Content-Type: multipart/alternative;
boundary="----=_Part_51_551621532.1421258027137"
------=_Part_51_551621532.1421258027137
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
Hello sir, I have made ashort note on this namespace topic with examples=
=20
that may give u clarity abt these things. I hope it will be helpful for u..=
=20
http://comsciguide.blogspot.in/2014/12/namespace_26.html
On Tuesday, October 21, 2014 at 8:25:26 AM UTC+5:30, David Rodr=C3=ADguez I=
beas=20
wrote:
>
> Personally I prefer to have variables live in the smallest scope possible=
=20
> as it makes reasoning about the code simpler to the programmer. It also=
=20
> makes it simpler for an optimizer to reason about the lifetime of the=20
> variables and often helps with optimizations.
>
> From the description it is not clear to me whether you want to have=20
> separate subgroups of members (whose lifetime is still controlled by the=
=20
> lifetime of the complete object) or else you just want this as a shorthan=
d=20
> not to have to create the separate variables. For the former there is no=
=20
> ideal solution, but I have not faced that as a problem that is not solved=
=20
> with refactoring. If it is the latter, it is simpler and better to make=
=20
> the variables local to each function.
>
> David
>
> On Mon, Oct 20, 2014 at 6:58 PM, <con...@ncomputers.org <javascript:>>=20
> wrote:
>
>> I recognize that I don't have neither the enough experience and the=20
>> enough knowledge to write a proposal with high probabilities to become=
=20
>> standard and to be considered seriously by the international ISO/ANSI C+=
+=20
>> committee.
>>
>> But I come here, I come to you as a customer. I am a customer of the=20
>> ISO/ANSI C++ programming language, because I use it. I write computer co=
des=20
>> using this language. I consume its words. I come here and share my=20
>> suggestions with the intention to improve the product, the amazing C++=
=20
>> programming language.
>>
>> Because if the ISO/ANSI C++ committee's erudites (all of you), decide to=
=20
>> act as provider and hear me as a customer, you can gain some ideas to=20
>> improve the product, the C++ programming language. To improve it could e=
ase=20
>> the life not only of the programmers while they write codes consuming it=
s=20
>> words, but also of every living being of the earth, because technology i=
s=20
>> today a very important support of our lifes.
>>
>> For your comments, your time, your patience and your help, that at the=
=20
>> end become contributions, which I want to turn into solutions: I am=20
>> infinite thankful to all of you!
>>
>> Nested namespaces by classes It is possible to nest a namespace inside=
=20
>> another namespace.
>>
>> Classes, structs and unions are also namespaces, despite they have other=
=20
>> purpose.
>>
>> Theoretically it should be possible to nest namespaces inside classes,=
=20
>> structs and unions, what could be very useful.
>>
>> *For example:*
>>
>> When several class members require the same variables, it could be usefu=
l=20
>> for the programmer to use *nested namespaces* to avoid the=20
>> re-declaration of the same variables.
>>
>> It can also help compilers to optimize the code.
>>
>> Personally I like to avoid the re-declaration of the same variables=20
>> inside different scopes, because sometimes they are too much.
>>
>> I don't like either let them easily accessible.
>>
>> When it is easy to access them, it is possible to use them accidentally,=
=20
>> what can cause problems, which sometimes require hours to find, because=
=20
>> they are hard to see.
>>
>> Without *nested namespaces by classes*, I do prefer to re-declare the=20
>> same variables inside each scope to avoid confusions, despite it is an=
=20
>> avoidable tedious task.
>>
>> On these cases, it would be easier to write: using namespace name;=20
>> inside the scope than to re-declare the same variables again.
>>
>> It would also ease the identifying of scopes with shared variables.
>>
>> Other reason to suggest this improvement is that it would allow to mix *=
nested=20
>> namespaces* with templates.
>>
>> *Downloads: *nested namespaces classes.cpp=20
>> <http://ncomputers.org/download/code/suggestions/nested%20namespaces%20c=
lasses.cpp>
>>
>> template<typename Typename>
>> struct Struct{
>> namespace shared{
>> Typename variable;
>> }
>> =20
>> Struct():
>> shared::variable(0)
>> {}
>> =20
>> void Function_1(){
>> //shared variable is visible
>> using namespace shared;
>> }
>> =20
>> void Function_2(){
>> //use special variable
>> int variable;
>> }
>> =20
>> void Function_3(){
>> {
>> //shared variable is visible
>> using namespace shared;
>> }
>> //use special variable
>> int variable;
>> }
>> };=20
>>
>> Last modified: 2014 - Oct - 20=20
>>
>> --=20
>>
>> ---=20
>> You received this message because you are subscribed to the Google Group=
s=20
>> "ISO C++ Standard - Future Proposals" group.
>> To unsubscribe from this group and stop receiving emails from it, send a=
n=20
>> email to std-proposal...@isocpp.org <javascript:>.
>> To post to this group, send email to std-pr...@isocpp.org <javascript:>.
>> Visit this group at=20
>> http://groups.google.com/a/isocpp.org/group/std-proposals/.
>>
>
>
--=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.
Visit this group at http://groups.google.com/a/isocpp.org/group/std-proposa=
ls/.
------=_Part_51_551621532.1421258027137
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir=3D"ltr"><span class=3D"GFP-UI5CHIB"><span></span> </span> <di=
v class=3D"GFP-UI5CAKB" tabindex=3D"0"><input style=3D"opacity: 0; height: =
1px; width: 1px; z-index: -1; overflow: hidden; position: absolute;" role=
=3D"presentation" tabindex=3D"-1" type=3D"text"><div><div style=3D"overflow=
: auto"><div dir=3D"ltr">Hello
sir, I have made ashort note on this namespace topic with examples=
=20
that may give u clarity abt these things. I hope it will be helpful for=20
u.. </div></div></div></div><br><a href=3D"http://comsciguide.blogspot.in/2=
014/12/namespace_26.html">http://comsciguide.blogspot.in/2014/12/namespace_=
26.html</a><br>On Tuesday, October 21, 2014 at 8:25:26 AM UTC+5:30, David R=
odr=C3=ADguez Ibeas 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">Personally I prefer to have variables live in the smallest sco=
pe possible as it makes reasoning about the code simpler to the programmer.=
It also makes it simpler for an optimizer to reason about the lifetime of =
the variables and often helps with optimizations.<div><br></div><div>From t=
he description it is not clear to me whether you want to have separate subg=
roups of members (whose lifetime is still controlled by the lifetime of the=
complete object) or else you just want this as a shorthand not to have to =
create the separate variables. For the former there is no ideal solution, b=
ut I have not faced that as a problem that is not solved with refactoring.&=
nbsp; If it is the latter, it is simpler and better to make the variables l=
ocal to each function.</div><div><br></div><div> David</div></=
div><div><br><div class=3D"gmail_quote">On Mon, Oct 20, 2014 at 6:58 PM, <=
span dir=3D"ltr"><<a href=3D"javascript:" target=3D"_blank" gdf-obfuscat=
ed-mailto=3D"7IXaZB4G5_kJ" onmousedown=3D"this.href=3D'javascript:';return =
true;" onclick=3D"this.href=3D'javascript:';return true;">con...@ncomputers=
..org</a>></span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"ma=
rgin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir=3D"lt=
r">I recognize that I don't have neither the enough experience and the enou=
gh knowledge to write a proposal with high probabilities to become standard=
and to be considered seriously by the international ISO/ANSI C++ committee=
..<br><br>But I come here, I come to you as a customer. I am a customer of t=
he ISO/ANSI C++ programming language, because I use it. I write computer co=
des using this language. I consume its words. I come here and share my sugg=
estions with the intention to improve the product, the amazing C++ programm=
ing language.<br><br>Because if the ISO/ANSI C++ committee's erudites (all =
of you), decide to act as provider and hear me as a customer, you can gain =
some ideas to improve the product, the C++ programming language. To improve=
it could ease the life not only of the programmers while they write codes =
consuming its words, but also of every living being of the earth, because t=
echnology is today a very important support of our lifes.<br><br>For your c=
omments, your time, your patience and your help, that at the end become con=
tributions, which I want to turn into solutions: I am infinite thankful to =
all of you!<br><br><h1>Nested namespaces by classes</h1>
It is possible to nest a namespace inside another namespace.<br><br>
Classes, structs and unions are also namespaces, despite they have other pu=
rpose.<br><br>
Theoretically it should be possible to nest namespaces inside classes, stru=
cts and unions, what could be very useful.<br><br>
<b>For example:</b><br><br>
When several class members require the same variables, it could be useful f=
or the programmer to use <b>nested namespaces</b> to avoid the re-declarati=
on of the same variables.<br><br>
It can also help compilers to optimize the code.<br><br>
Personally I like to avoid the re-declaration of the same variables=20
inside different scopes, because sometimes they are too much.<br><br>
I don't like either let them easily accessible.<br><br>
When it is easy to access them, it is possible to use them accidentally,
what can cause problems, which sometimes require hours to find, because
they are hard to see.<br><br>
Without <b>nested namespaces by classes</b>, I do prefer to re-declare the =
same variables inside each scope to avoid confusions, despite it is an avoi=
dable tedious task.<br><br>
On these cases, it would be easier to write: <code><span>using namespace</s=
pan> name;</code> inside the scope than to re-declare the same variables ag=
ain.<br><br>
It would also ease the identifying of scopes with shared variables.<br><br>
Other reason to suggest this improvement is that it would allow to mix <b>n=
ested namespaces</b> with templates.<br><br>
<b>Downloads: </b><a href=3D"http://ncomputers.org/download/code/suggestion=
s/nested%20namespaces%20classes.cpp" target=3D"_blank" onmousedown=3D"this.=
href=3D'http://www.google.com/url?q\75http%3A%2F%2Fncomputers.org%2Fdownloa=
d%2Fcode%2Fsuggestions%2Fnested%2520namespaces%2520classes.cpp\46sa\75D\46s=
ntz\0751\46usg\75AFQjCNEZabyug6p8MPgpL6s37p1twRGfRA';return true;" onclick=
=3D"this.href=3D'http://www.google.com/url?q\75http%3A%2F%2Fncomputers.org%=
2Fdownload%2Fcode%2Fsuggestions%2Fnested%2520namespaces%2520classes.cpp\46s=
a\75D\46sntz\0751\46usg\75AFQjCNEZabyug6p8MPgpL6s37p1twRGfRA';return true;"=
>nested namespaces classes.cpp</a><br><br>
<u></u><code>
<div style=3D"background-color:rgb(250,250,250);border-color:rgb(187,187,18=
7);border-style:solid;border-width:1px;word-wrap:break-word"><code><div><sp=
an style=3D"color:#008">template</span><span style=3D"color:#660"><</spa=
n><span style=3D"color:#008">typename</span><span style=3D"color:#000"> </s=
pan><span style=3D"color:#606">Typename</span><span style=3D"color:#660">&g=
t;</span><span style=3D"color:#000"><br></span><span style=3D"color:#008">s=
truct</span><span style=3D"color:#000"> </span><span style=3D"color:#606">S=
truct</span><span style=3D"color:#660">{</span><span style=3D"color:#000"><=
br> </span><span style=3D"color:#008">namespace</span><s=
pan style=3D"color:#000"> shared</span><span style=3D"color:#660">{</span><=
span style=3D"color:#000"><br> </span><spa=
n style=3D"color:#606">Typename</span><span style=3D"color:#000"> variable<=
/span><span style=3D"color:#660">;</span><span style=3D"color:#000"><br>&nb=
sp; </span><span style=3D"color:#660">}</span><span style=3D"c=
olor:#000"><br> <br> </span><span style=3D"color:#6=
06">Struct</span><span style=3D"color:#660">():</span><span style=3D"color:=
#000"><br> shared</span><span style=3D"col=
or:#660">::</span><span style=3D"color:#000">variable</span><span style=3D"=
color:#660">(</span><span style=3D"color:#066">0</span><span style=3D"color=
:#660">)</span><span style=3D"color:#000"><br> </span><s=
pan style=3D"color:#660">{}</span><span style=3D"color:#000"><br> <br>=
</span><span style=3D"color:#008">void</span><span styl=
e=3D"color:#000"> </span><span style=3D"color:#606">Function_1</span><span =
style=3D"color:#660">(){</span><span style=3D"color:#000"><br> =
</span><span style=3D"color:#800">//shared variable is=
visible</span><span style=3D"color:#000"><br> &=
nbsp;</span><span style=3D"color:#008">using</span><span style=3D"color:#00=
0"> </span><span style=3D"color:#008">namespace</span><span style=3D"color:=
#000"> shared</span><span style=3D"color:#660">;</span><span style=3D"color=
:#000"><br> </span><span style=3D"color:#660">}</span><s=
pan style=3D"color:#000"><br> <br> </span><span sty=
le=3D"color:#008">void</span><span style=3D"color:#000"> </span><span style=
=3D"color:#606">Function_2</span><span style=3D"color:#660">(){</span><span=
style=3D"color:#000"><br> </span><span st=
yle=3D"color:#800">//use special variable</span><span style=3D"color:#000">=
<br> </span><span style=3D"color:#008">int=
</span><span style=3D"color:#000"> variable</span><span style=3D"color:#660=
">;</span><span style=3D"color:#000"><br> </span><span s=
tyle=3D"color:#660">}</span><span style=3D"color:#000"><br> <br> =
</span><span style=3D"color:#008">void</span><span style=3D"c=
olor:#000"> </span><span style=3D"color:#606">Function_3</span><span style=
=3D"color:#660">(){</span><span style=3D"color:#000"><br> &nbs=
p; </span><span style=3D"color:#660">{</span><span style=3D"co=
lor:#000"><br> </span><span =
style=3D"color:#800">//shared variable is visible</span><span style=3D"colo=
r:#000"><br> </span><span st=
yle=3D"color:#008">using</span><span style=3D"color:#000"> </span><span sty=
le=3D"color:#008">namespace</span><span style=3D"color:#000"> shared</span>=
<span style=3D"color:#660">;</span><span style=3D"color:#000"><br> &n=
bsp; </span><span style=3D"color:#660">}</span><span st=
yle=3D"color:#000"><br> </span><span style=
=3D"color:#800">//use special variable</span><span style=3D"color:#000"><br=
> </span><span style=3D"color:#008">int</s=
pan><span style=3D"color:#000"> variable</span><span style=3D"color:#660">;=
</span><span style=3D"color:#000"><br></span><span style=3D"color:#000">&nb=
sp; </span><span style=3D"color:#660">}</span><span style=3D"c=
olor:#000"><br></span><span style=3D"color:#660">};</span><span style=3D"co=
lor:#000"> </span></div></code></div><br></code><u></u>Last modified: 2014 =
- Oct - 20 <br></div><span><font color=3D"#888888">
<p></p>
-- <br>
<br>
--- <br>
You received this message because you are subscribed to the Google Groups "=
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"javascript:" target=3D"_blank" gdf-obfuscated-mailto=3D"=
7IXaZB4G5_kJ" onmousedown=3D"this.href=3D'javascript:';return true;" onclic=
k=3D"this.href=3D'javascript:';return true;">std-proposal...@<wbr>isocpp.or=
g</a>.<br>
To post to this group, send email to <a href=3D"javascript:" target=3D"_bla=
nk" gdf-obfuscated-mailto=3D"7IXaZB4G5_kJ" onmousedown=3D"this.href=3D'java=
script:';return true;" onclick=3D"this.href=3D'javascript:';return true;">s=
td-pr...@isocpp.org</a>.<br>
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/" target=3D"_blank" onmousedown=3D"this.href=3D'http://groups=
..google.com/a/isocpp.org/group/std-proposals/';return true;" onclick=3D"thi=
s.href=3D'http://groups.google.com/a/isocpp.org/group/std-proposals/';retur=
n true;">http://groups.google.com/a/<wbr>isocpp.org/group/std-<wbr>proposal=
s/</a>.<br>
</font></span></blockquote></div><br></div>
</blockquote></div>
<p></p>
-- <br />
<br />
--- <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 />
Visit this group at <a href=3D"http://groups.google.com/a/isocpp.org/group/=
std-proposals/">http://groups.google.com/a/isocpp.org/group/std-proposals/<=
/a>.<br />
------=_Part_51_551621532.1421258027137--
------=_Part_50_1431986723.1421258027137--
.