Topic: What else can be template, extending the language


Author: mobiphil <mobi@mobiphil.com>
Date: Sat, 31 Jan 2015 03:38:36 -0800 (PST)
Raw View
------=_Part_1707_755851481.1422704316422
Content-Type: multipart/alternative;
 boundary="----=_Part_1708_1230069162.1422704316422"

------=_Part_1708_1230069162.1422704316422
Content-Type: text/plain; charset=UTF-8

Without pretending this being a proposal I would love to get feedback on on
this mini-brainstorming. Having just seen the proposal about templates for
namespaces, I would like to play with idea of generalizing the idea of
templates. I tend to believe that other people reflected about similar
concepts, but difficult to find traces.

First candidate that comes to my mind is generating some part of the entity
being templetized. A trivial example would be:

class Example {

  private:
     int value;
  public:
    int getValue();
    setValue(int v);
};

A template like
class Example {
   attribute<int, value>;
}

Would be of a very great help. Keep in mind, that I left the domain of
"classical templates". I know that this involves syntactic issues.
attribute<int, value> is not necessarily elegant here. Could be also
expressed with attributes like:
class Example {
   [[withaccessors]] int value;
}

Another useful one would be "some mechanism" that would convert members of
a class to "something else". The some mechanism could be again some sort of
generalized template, and something else for example a parameter pack.

Let's say I want a method that prints to JSON all the members:

template<typename... Args>
toJson( joJson(args)... )

class Person {
   private:
         string name;
         int age;
};

void someMethod() {

    Person person = getPerson();
    toJson( members<Person>(person) );
}

--

---
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_1708_1230069162.1422704316422
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Without pretending this being a proposal I would love=
 to get feedback on on this mini-brainstorming. Having just seen the propos=
al about templates for namespaces, I would like to play with idea of genera=
lizing the idea of templates. I tend to believe that other people reflected=
 about similar concepts, but difficult to find traces.</div><div><br></div>=
<div>First candidate that comes to my mind is generating some part of the e=
ntity being templetized. A trivial example would be:</div><div><br></div><d=
iv>class Example {<br></div><div><br></div><div>&nbsp; private:</div><div>&=
nbsp; &nbsp; &nbsp;int value;</div><div>&nbsp; public:<br></div><div>&nbsp;=
 &nbsp; int getValue();</div><div>&nbsp; &nbsp; setValue(int v);</div><div>=
};</div><div><br></div><div>A template like&nbsp;</div><div>class Example {=
</div><div>&nbsp; &nbsp;attribute&lt;int, value&gt;;</div><div>}</div><div>=
<br></div><div>Would be of a very great help. Keep in mind, that I left the=
 domain of "classical templates". I know that this involves syntactic issue=
s. attribute&lt;int, value&gt; is not necessarily elegant here. Could be al=
so expressed with attributes like:</div><div>class Example {</div><div>&nbs=
p; &nbsp;[[withaccessors]] int value;<br></div><div>}</div><div><br></div><=
div>Another useful one would be "some mechanism" that would convert members=
 of a class to "something else". The some mechanism could be again some sor=
t of generalized template, and something else for example a parameter pack.=
&nbsp;<br></div><div><br></div><div>Let's say I want a method that prints t=
o JSON all the members:</div><div><br></div><div>template&lt;typename... Ar=
gs&gt;</div><div>toJson( joJson(args)... )</div><div><br></div><div>class P=
erson {</div><div>&nbsp; &nbsp;private:</div><div>&nbsp; &nbsp; &nbsp; &nbs=
p; &nbsp;string name;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;int age;<=
/div><div>};<br></div><div><br></div><div>void someMethod() {</div><div>&nb=
sp;</div><div>&nbsp; &nbsp; Person person =3D getPerson();</div><div>&nbsp;=
 &nbsp; toJson( members&lt;Person&gt;(person) );&nbsp;</div><div>}</div><di=
v><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&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
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_1708_1230069162.1422704316422--
------=_Part_1707_755851481.1422704316422--

.


Author: gmisocpp@gmail.com
Date: Sat, 31 Jan 2015 12:03:59 -0800 (PST)
Raw View
------=_Part_1506_569688865.1422734639780
Content-Type: multipart/alternative;
 boundary="----=_Part_1507_1278655729.1422734639780"

------=_Part_1507_1278655729.1422734639780
Content-Type: text/plain; charset=UTF-8

I'm not sure I understand if or how this is generalizing templates.

But for the purpose of auto generating getter and setter functions, I don't
think using C++ attributes, i.e. [[withaccessors]] would be good.
I thought the consensus is to try not to use a C++ attribute if ignoring
that attribute would change the meaning of the program.
As I don't see how the example given in the original post would compile if
the [[withaccessors[ attribute were ignored, that route seems a bad way to
go.

I'd prefer something more like this for the purposes of getter setters
anyway though it doesn't "generalize templates" so may not help your
proposal.
In fact it would possibly reduce the value of your proposal by subsuming
one of your proposals features if this existed in this way, but I may be
wrong.

Anyway, for auto getter/setters, I think I'd prefer something more like
this:

class X
{
    int x get, set;
    // auto generate public get_x and set_x methods.
};

class X
{
    int x get(GetX), set(SetX);
    // add public GetX and SetX but change the default names.
};

class X
{
    int x get(GetX), set(private SetX);
    // add public GetX and private SetX.
};

Heretic: Perhaps also specify that where any member has a getter or setter
generated like this, enable a property like syntax too.
e.g.:

int main
{
    X o;
    o.x = 100; // o.set_x(100)
    int x = o.x; // x = o.get_x()
};


But overall, I am not convinced of the value of any of this (even my own
suggestions here).
I don't think an auto generated getter setter is of as much value as is
often suggested.
In my experience if I start out thinking a public getter and setter that
does nothing but hide a private data field, I usually discover I don't need
abstraction anyway and a simple public data field is fine too.

And where I start off having any doubt about the wisdom of the
first statement above, I quickly find I need a proper function with a more
complex implementation is needed and the default implementation (a simple
set/get) wouldn't have been enough for my needs anyway.

So overall, I don't see that default get/set generation of getter/setter
functions is usually a good thing as it appears it offers either too much
or not enough in practice most of the time.

But other people willl differently about this. Sorry if I've missed the
emphasis of your proposal here though. I'm a bit unclear on it.

--

---
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_1507_1278655729.1422734639780
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>I'm not sure&nbsp;I understand&nbsp;if or how this is=
 generalizing templates.</div><div><br></div><div>But&nbsp;for the&nbsp;pur=
pose of auto generating&nbsp;getter and setter functions, I don't think usi=
ng C++ attributes, i.e. [[withaccessors]]&nbsp;would be good.</div><div>I t=
hought the consensus is to try not to use a C++ attribute if ignoring that =
attribute would change the meaning of the program.</div><div>As I don't see=
 how the example given in the original post would compile if the&nbsp;[[wit=
haccessors[ attribute were ignored, that route seems a bad way to go.</div>=
<div><br></div><div>I'd prefer something more like this for the purposes of=
 getter setters anyway though it doesn't "generalize templates" so may not =
help your proposal.</div><div>In fact it would possibly reduce the value of=
 your proposal by subsuming one of&nbsp;your&nbsp;proposals features if thi=
s&nbsp;existed in this way, but I may be wrong.</div><div><br></div><div>An=
yway, for auto getter/setters, I think I'd prefer something more like this:=
</div><div><br></div><div>class X<br>{<br>&nbsp;&nbsp;&nbsp; int x get, set=
;<br>&nbsp;&nbsp;&nbsp; // auto generate&nbsp;public get_x and set_x method=
s.<br>};</div><div><br></div><div>class X<br>{<br>&nbsp;&nbsp;&nbsp; int x =
get(GetX), set(SetX);<br>&nbsp;&nbsp;&nbsp; // add public GetX and SetX but=
 change the default names.<br>};</div><div><br></div><div>class X<br>{<br>&=
nbsp;&nbsp;&nbsp; int x get(GetX), set(private SetX);<br>&nbsp;&nbsp;&nbsp;=
 // add public GetX and private SetX.<br>};</div><div><br></div><div>Hereti=
c: Perhaps also specify that where any member has a getter or setter genera=
ted like this, enable a property like syntax too.<br></div><div>e.g.:<br></=
div><div><br></div><div>int main<br>{<br>&nbsp;&nbsp;&nbsp; X o;<br>&nbsp;&=
nbsp;&nbsp; o.x =3D 100; // o.set_x(100)<br>&nbsp;&nbsp;&nbsp; int x =3D o.=
x; // x =3D o.get_x()<br>};</div><div><br></div><div><br></div><div>But ove=
rall, I am not convinced of the value of any of this (even my own suggestio=
ns here).</div><div>I don't think an auto generated getter setter is of as =
much value as is often suggested.</div><div>In my experience if I start out=
 thinking a public getter and setter that does nothing but hide&nbsp;a priv=
ate data field, I usually discover I don't need abstraction anyway and a si=
mple public data field is fine too.</div><div><br></div><div>And where&nbsp=
;I start off having any doubt&nbsp;about the wisdom of the first&nbsp;state=
ment above,&nbsp;I quickly find I need a proper function&nbsp;with&nbsp;a m=
ore complex implementation is needed and the default implementation (a simp=
le set/get) wouldn't have been enough for my needs anyway.</div><div><br></=
div><div>So overall, I don't see that default get/set generation of&nbsp;ge=
tter/setter functions&nbsp;is usually a good thing as&nbsp;it appears&nbsp;=
it offers either too much or not enough in practice most of the time.</div>=
<div><br></div><div>But other people&nbsp;willl differently about this. Sor=
ry if I've missed the emphasis of your proposal here though. I'm a bit uncl=
ear on it.<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&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
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_1507_1278655729.1422734639780--
------=_Part_1506_569688865.1422734639780--

.


Author: Scott Prager <splinterofchaos@gmail.com>
Date: Sat, 31 Jan 2015 12:19:47 -0800 (PST)
Raw View
------=_Part_209_2010268218.1422735587617
Content-Type: multipart/alternative;
 boundary="----=_Part_210_217721675.1422735587617"

------=_Part_210_217721675.1422735587617
Content-Type: text/plain; charset=UTF-8

On Saturday, January 31, 2015 at 6:38:36 AM UTC-5, mobiphil wrote:


> First candidate that comes to my mind is generating some part of the
> entity being templetized. A trivial example would be:
>
> class Example {
>
>   private:
>      int value;
>   public:
>     int getValue();
>     setValue(int v);
> };
>
> A template like
> class Example {
>    attribute<int, value>;
> }
>

When you post an example like this, it would be helpful to include a little
function and list some inputs and expected outputs. Really not sure what
semantics you intended "attribute<int, value>" to convey.


>
> Would be of a very great help. Keep in mind, that I left the domain of
> "classical templates". I know that this involves syntactic issues.
> attribute<int, value> is not necessarily elegant here. Could be also
> expressed with attributes like:
> class Example {
>    [[withaccessors]] int value;
> }
>

Attributes express hints to the compiler and user about how the code should
be generated. This would be very inconsistent.

Also, the idea of automatically creating accessors for variables has been
discussed to death. Some have even suggested syntaxes where you can specify
a variable is read-only (has a getter, but no setter), write-only, etc.. At
some point, the discussion always involves the topic: Are accessor
functions better than public members anyway?


>
> Another useful one would be "some mechanism" that would convert members of
> a class to "something else". The some mechanism could be again some sort of
> generalized template, and something else for example a parameter pack.
>
> Let's say I want a method that prints to JSON all the members:
>
> template<typename... Args>
> toJson( joJson(args)... )
>
> class Person {
>    private:
>          string name;
>          int age;
> };
>
> void someMethod() {
>
>     Person person = getPerson();
>     toJson( members<Person>(person) );
> }
>

You may be interested in this:
https://github.com/jaredhoberock/tuple_utility

Basically you could define your Person using tuple_traits<Person> (should
be a friend of Person) and use something like "tuple_map(toJson, person)".

--

---
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_210_217721675.1422735587617
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">On Saturday, January 31, 2015 at 6:38:36 AM UTC-5, mobiphi=
l wrote:<div>&nbsp;</div><blockquote class=3D"gmail_quote" style=3D"margin:=
 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div =
dir=3D"ltr"><div></div><div>First candidate that comes to my mind is genera=
ting some part of the entity being templetized. A trivial example would be:=
</div><div><br></div><div>class Example {<br></div><div><br></div><div>&nbs=
p; private:</div><div>&nbsp; &nbsp; &nbsp;int value;</div><div>&nbsp; publi=
c:<br></div><div>&nbsp; &nbsp; int getValue();</div><div>&nbsp; &nbsp; setV=
alue(int v);</div><div>};</div><div><br></div><div>A template like&nbsp;</d=
iv><div>class Example {</div><div>&nbsp; &nbsp;attribute&lt;int, value&gt;;=
</div><div>}</div></div></blockquote><div><br></div><div>When you post an e=
xample like this, it would be helpful to include a little function and list=
 some inputs and&nbsp;<span style=3D"font-size: 13.3333339691162px;">expect=
ed</span><span style=3D"font-size: 13.3333339691162px;">&nbsp;</span><span =
style=3D"font-size: 13px;">outputs. Really not sure what semantics you inte=
nded "attribute&lt;int, value&gt;" to convey.</span></div><div>&nbsp;</div>=
<blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;bor=
der-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div><br></di=
v><div>Would be of a very great help. Keep in mind, that I left the domain =
of "classical templates". I know that this involves syntactic issues. attri=
bute&lt;int, value&gt; is not necessarily elegant here. Could be also expre=
ssed with attributes like:</div><div>class Example {</div><div>&nbsp; &nbsp=
;[[withaccessors]] int value;<br></div><div>}</div></div></blockquote><div>=
<br></div><div>Attributes express hints to the compiler and user about how =
the code should be generated. This would be very inconsistent.</div><div><b=
r></div><div>Also, the idea of automatically creating accessors for variabl=
es has been discussed to death. Some have even suggested syntaxes where you=
 can specify a variable is read-only (has a getter, but no setter), write-o=
nly, etc.. At some point, the discussion always involves the topic: Are acc=
essor functions better than public members anyway?&nbsp;</div><div>&nbsp;</=
div><blockquote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex=
;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div><br>=
</div><div>Another useful one would be "some mechanism" that would convert =
members of a class to "something else". The some mechanism could be again s=
ome sort of generalized template, and something else for example a paramete=
r pack.&nbsp;<br></div><div><br></div><div>Let's say I want a method that p=
rints to JSON all the members:</div><div><br></div><div>template&lt;typenam=
e... Args&gt;</div><div>toJson( joJson(args)... )</div><div><br></div><div>=
class Person {</div><div>&nbsp; &nbsp;private:</div><div>&nbsp; &nbsp; &nbs=
p; &nbsp; &nbsp;string name;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;in=
t age;</div><div>};<br></div><div><br></div><div>void someMethod() {</div><=
div>&nbsp;</div><div>&nbsp; &nbsp; Person person =3D getPerson();</div><div=
>&nbsp; &nbsp; toJson( members&lt;Person&gt;(person) );&nbsp;</div><div>}</=
div></div></blockquote><div><br></div><div>You may be interested in this: h=
ttps://github.com/jaredhoberock/tuple_utility</div><div><br></div><div>Basi=
cally you could define your Person using tuple_traits&lt;Person&gt; (should=
 be a friend of Person) and use something like "tuple_map(toJson, person)".=
</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&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
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_210_217721675.1422735587617--
------=_Part_209_2010268218.1422735587617--

.


Author: mobiphil <mobi@mobiphil.com>
Date: Sat, 31 Jan 2015 14:51:03 -0800 (PST)
Raw View
------=_Part_2061_1776094006.1422744663944
Content-Type: multipart/alternative;
 boundary="----=_Part_2062_789265542.1422744663944"

------=_Part_2062_789265542.1422744663944
Content-Type: text/plain; charset=UTF-8

Hi,

I have to admit that my description was rather poor and the first example
was not the best. I think the triviality of the first example did not allow
the reader to consider the second example that would be much more relevant.
What I need more often is the second example where I would like the
compiler to generate me some code based on information it knows. And it was
about generating some code in particular case to print all member variables
using functions it would have knowledge about.



> Another useful one would be "some mechanism" that would convert members of
> a class to "something else". The some mechanism could be again some sort of
> generalized template, and something else for example a parameter pack.
> Let's say I want a method that prints to JSON all the members:
>
> template<typename... Args>
> toJson( joJson(args)... )
>
> class Person {
>    private:
>          string name;
>          int age;
> };
>
> void someMethod() {
>
>     Person person = getPerson();
>     toJson( members<Person>(person) );
> }
>

the members<Person> would be here a generalized template, that would expand
to the members of type Person to a variable template parameter list. I used
the term of generalized with the meaning of being able to apply templates
to anything possible using knowledge of the compiler when compiling a
certain part of the code. Most of such "seeds" like members<> template
could be implemented only by the compiler (I called plugins), but lot could
be built probably around such constructs.



--

---
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_2062_789265542.1422744663944
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Hi,&nbsp;</div><div><br></div><div>I have to admit th=
at my description was rather poor and the first example was not the best. I=
 think the triviality of the first example did not allow the reader to cons=
ider the second example that would be much more relevant. What I need more =
often is the second example where I would like the compiler to generate me =
some code based on information it knows. And it was about generating some c=
ode in particular case to print all member variables using functions it wou=
ld have knowledge about.</div><div><br></div><div>&nbsp;</div><blockquote c=
lass=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px=
 #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div>Another useful one wo=
uld be "some mechanism" that would convert members of a class to "something=
 else". The some mechanism could be again some sort of generalized template=
, and something else for example a parameter pack. Let's say I want a metho=
d that prints to JSON all the members:</div><div><br></div><div>template&lt=
;typename... Args&gt;</div><div>toJson( joJson(args)... )</div><div><br></d=
iv><div>class Person {</div><div>&nbsp; &nbsp;private:</div><div>&nbsp; &nb=
sp; &nbsp; &nbsp; &nbsp;string name;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; =
&nbsp;int age;</div><div>};<br></div><div><br></div><div>void someMethod() =
{</div><div>&nbsp;</div><div>&nbsp; &nbsp; Person person =3D getPerson();</=
div><div>&nbsp; &nbsp; toJson( members&lt;Person&gt;(person) );&nbsp;</div>=
<div>}</div></div></blockquote><div><br></div><div>the members&lt;Person&gt=
; would be here a generalized template, that would expand to the members of=
 type Person to a variable template parameter list. I used the term of gene=
ralized with the meaning of being able to apply templates to anything possi=
ble using knowledge of the compiler when compiling a certain part of the co=
de. Most of such "seeds" like members&lt;&gt; template could be implemented=
 only by the compiler (I called plugins), but lot could be built probably a=
round such constructs.</div><div><br></div><div><br></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&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
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_2062_789265542.1422744663944--
------=_Part_2061_1776094006.1422744663944--

.


Author: mobiphil <mobi@mobiphil.com>
Date: Sun, 1 Feb 2015 06:23:48 -0800 (PST)
Raw View
------=_Part_2568_605770418.1422800628197
Content-Type: multipart/alternative;
 boundary="----=_Part_2569_2110928546.1422800628197"

------=_Part_2569_2110928546.1422800628197
Content-Type: text/plain; charset=UTF-8

other two usecases:

1. expanding the arguments of a function:

template <typename... Args>
trace(Args..);

void function1( Type1 t1, Type2 t2, Type3 t3) /* with whatsoever list of
parameters */
{
     trace( arguments<> );  //would expand the current arguments of the
function
}

2. expanding the local variables of a function:
void function2() {

/* some local variable declarations */

     {
         /* somewhere in the code */
        trace( locals<> );
     }
}

3. expanding global variables: similar like locals

4. template parameter expansion

template <typename... Args>
struct {
    expand<Args.., sepaarator<;> >;
};

expand<Args> would just list the parameters into member list...










--

---
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_2569_2110928546.1422800628197
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">other two usecases:<div><br></div><div>1. expanding the ar=
guments of a function:</div><div><br></div><div>template &lt;typename... Ar=
gs&gt;</div><div>trace(Args..);</div><div><br></div><div>void function1( Ty=
pe1 t1, Type2 t2, Type3 t3) /* with whatsoever list of parameters */</div><=
div>{</div><div>&nbsp; &nbsp; &nbsp;trace( arguments&lt;&gt; ); &nbsp;//wou=
ld expand the current arguments of the function</div><div>}<br></div><div><=
br>2. expanding the local variables of a function:</div><div>void function2=
() {</div><div><br></div><div>/* some local variable declarations */</div><=
div><br></div><div>&nbsp; &nbsp; &nbsp;{</div><div>&nbsp; &nbsp; &nbsp; &nb=
sp; &nbsp;/* somewhere in the code */</div><div>&nbsp; &nbsp; &nbsp; &nbsp;=
 trace( locals&lt;&gt; );</div><div>&nbsp; &nbsp; &nbsp;}</div><div>}<br></=
div><div><br></div><div>3. expanding global variables: similar like locals<=
/div><div><br></div><div>4. template parameter expansion</div><div><br></di=
v><div><div>template &lt;typename... Args&gt;&nbsp;</div><div>struct {<br><=
/div><div>&nbsp; &nbsp; expand&lt;Args.., sepaarator&lt;;&gt; &gt;;<br></di=
v><div>};</div><div><br></div><div>expand&lt;Args&gt; would just list the p=
arameters into member list...</div><div><br></div><div><br></div><div><br><=
/div></div><div><br></div><div><br></div><div><br></div><div><br></div><div=
><br></div><div><br></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&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
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_2569_2110928546.1422800628197--
------=_Part_2568_605770418.1422800628197--

.


Author: Bengt Gustafsson <bengt.gustafsson@beamways.com>
Date: Sun, 1 Feb 2015 14:51:47 -0800 (PST)
Raw View
------=_Part_2189_1021105605.1422831107975
Content-Type: multipart/alternative;
 boundary="----=_Part_2190_1180080058.1422831107975"

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

This seems to be rather close to what is intended to come out of the=20
reflection work. Maybe someone can point at the latest N-number for this?

Also I think you should explain how you intend the toJson() function to be=
=20
implemented and what information can be extracted from the elements of the=
=20
members<> template and how this is done. To create the JSON representation=
=20
you need to know the member names at least...

I think that your ideas regarding getting the list of "my own" function=20
parameters, local variables and globals are new ideas which maybe would be=
=20
worth adding to the reflection system. Globals seems quite scary though,=20
thousands of template parameters in some cases...


Den l=C3=B6rdag 31 januari 2015 kl. 12:38:36 UTC+1 skrev mobiphil:
>
> Without pretending this being a proposal I would love to get feedback on=
=20
> on this mini-brainstorming. Having just seen the proposal about templates=
=20
> for namespaces, I would like to play with idea of generalizing the idea o=
f=20
> templates. I tend to believe that other people reflected about similar=20
> concepts, but difficult to find traces.
>
> First candidate that comes to my mind is generating some part of the=20
> entity being templetized. A trivial example would be:
>
> class Example {
>
>   private:
>      int value;
>   public:
>     int getValue();
>     setValue(int v);
> };
>
> A template like=20
> class Example {
>    attribute<int, value>;
> }
>
> Would be of a very great help. Keep in mind, that I left the domain of=20
> "classical templates". I know that this involves syntactic issues.=20
> attribute<int, value> is not necessarily elegant here. Could be also=20
> expressed with attributes like:
> class Example {
>    [[withaccessors]] int value;
> }
>
> Another useful one would be "some mechanism" that would convert members o=
f=20
> a class to "something else". The some mechanism could be again some sort =
of=20
> generalized template, and something else for example a parameter pack.=20
>
> Let's say I want a method that prints to JSON all the members:
>
> template<typename... Args>
> toJson( joJson(args)... )
>
> class Person {
>    private:
>          string name;
>          int age;
> };
>
> void someMethod() {
> =20
>     Person person =3D getPerson();
>     toJson( members<Person>(person) );=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_2190_1180080058.1422831107975
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">This seems to be rather close to what is intended to come =
out of the reflection work. Maybe someone can point at the latest N-number =
for this?<div><br></div><div>Also I think you should explain how you intend=
 the toJson() function to be implemented and what information can be extrac=
ted from the elements of the members&lt;&gt; template and how this is done.=
 To create the JSON representation you need to know the member names at lea=
st...</div><div><br></div><div>I think that your ideas regarding getting th=
e list of "my own" function parameters, local variables and globals are new=
 ideas which maybe would be worth adding to the reflection system. Globals =
seems quite scary though, thousands of template parameters in some cases...=
</div><div><br><br>Den l=C3=B6rdag 31 januari 2015 kl. 12:38:36 UTC+1 skrev=
 mobiphil:<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"><di=
v>Without pretending this being a proposal I would love to get feedback on =
on this mini-brainstorming. Having just seen the proposal about templates f=
or namespaces, I would like to play with idea of generalizing the idea of t=
emplates. I tend to believe that other people reflected about similar conce=
pts, but difficult to find traces.</div><div><br></div><div>First candidate=
 that comes to my mind is generating some part of the entity being templeti=
zed. A trivial example would be:</div><div><br></div><div>class Example {<b=
r></div><div><br></div><div>&nbsp; private:</div><div>&nbsp; &nbsp; &nbsp;i=
nt value;</div><div>&nbsp; public:<br></div><div>&nbsp; &nbsp; int getValue=
();</div><div>&nbsp; &nbsp; setValue(int v);</div><div>};</div><div><br></d=
iv><div>A template like&nbsp;</div><div>class Example {</div><div>&nbsp; &n=
bsp;attribute&lt;int, value&gt;;</div><div>}</div><div><br></div><div>Would=
 be of a very great help. Keep in mind, that I left the domain of "classica=
l templates". I know that this involves syntactic issues. attribute&lt;int,=
 value&gt; is not necessarily elegant here. Could be also expressed with at=
tributes like:</div><div>class Example {</div><div>&nbsp; &nbsp;[[withacces=
sors]] int value;<br></div><div>}</div><div><br></div><div>Another useful o=
ne would be "some mechanism" that would convert members of a class to "some=
thing else". The some mechanism could be again some sort of generalized tem=
plate, and something else for example a parameter pack.&nbsp;<br></div><div=
><br></div><div>Let's say I want a method that prints to JSON all the membe=
rs:</div><div><br></div><div>template&lt;typename... Args&gt;</div><div>toJ=
son( joJson(args)... )</div><div><br></div><div>class Person {</div><div>&n=
bsp; &nbsp;private:</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;string name=
;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;int age;</div><div>};<br></di=
v><div><br></div><div>void someMethod() {</div><div>&nbsp;</div><div>&nbsp;=
 &nbsp; Person person =3D getPerson();</div><div>&nbsp; &nbsp; toJson( memb=
ers&lt;Person&gt;(person) );&nbsp;</div><div>}</div><div><br></div></div></=
blockquote></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&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
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_2190_1180080058.1422831107975--
------=_Part_2189_1021105605.1422831107975--

.


Author: mobiphil <mobi@mobiphil.com>
Date: Sun, 1 Feb 2015 17:23:47 -0800 (PST)
Raw View
------=_Part_510_939881953.1422840227427
Content-Type: multipart/alternative;
 boundary="----=_Part_511_1853760386.1422840227427"

------=_Part_511_1853760386.1422840227427
Content-Type: text/plain; charset=UTF-8


>
> This seems to be rather close to what is intended to come out of the
> reflection work. Maybe someone can point at the latest N-number for this?
>
well... the main idea of my non formal proposal is to create a "protocol"
to access compile time information. This would automatically cover also
reflection.

Spent recently some time to model object oriented programming in C with
macros. Defined some macros and defined kind of "mixins" that I could paste
both for creating the members and the reflection and and and...

if a mechanism, protocol or whatsoever we would like to call it would be in
place would be then a small step to create a compiler template.

class someClass {

   Type1 member1;
   Type2 member2

};
function reflect() {
   print(names<members><someClass>   >);
}


> Also I think you should explain how you intend the toJson() function to be
> implemented and what information can be extracted from the elements of the
> members<> template and how this is done. To create the JSON representation
> you need to know the member names at least...
>
Well, did not want to go into details. The toJson() would be some
overloaded function like the "<<" operators for streams.

let's go back to the example I wrote earlier:

class Person {
   private:
         string name;
         int age;
};

void someMethod() {

    Person person = getPerson();
    toJson( members<Person>(person) );
}

I use often the same mechanism to trace functions, but ha
void someMethod(Type1 t1, Type2 t2 /* and so on */) {

    Trace(t1, t2);  /* Trace macro can deduce the name of variables*/
    Person person = getPerson();
    toJson( members<Person>(person) );
}

Trace would expand to something:

stream << "{t1=" << t1 << ", t2" << t2 << "}" << endl;
now with a little syntactic sugare with these "generalized" templates, one
should be able to generate such code.

the toJson() would be a family of overloaded methods (templates) that would
just add some json encoding arround values and names.

>
> I think that your ideas regarding getting the list of "my own" function
> parameters, local variables and globals are new ideas which maybe would be
> worth adding to the reflection system. Globals seems quite scary though,
> thousands of template parameters in some cases...
>

what about reconsidering reflection system and extend the language to be
able to create scripts that would access the compiler knowledge. I think
would be a big step for several problems. I think lot of effort is wasted
by trying to be backword compatible. Also c++ compiler is becoming very
very slow because the language tried to be backward compatible etc.

Well, when I said globals, I was thinking about variables and not
everything. But why not inventing a way, a syntax where one could select
stuff from the current context/namespace. Say:

paste<type="variable" scope="local" regex="blahblah'> etc.

If this would gain attention, would be happy to spend time to formalize it
a bit more.


--

---
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_511_1853760386.1422840227427
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><blockquote class=3D"gmail_quote" style=3D"margin: 0;margi=
n-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"l=
tr">This seems to be rather close to what is intended to come out of the re=
flection work. Maybe someone can point at the latest N-number for this?</di=
v></blockquote><div>well... the main idea of my non formal proposal is to c=
reate a "protocol" to access compile time information. This would automatic=
ally cover also reflection.</div><div><br></div><div>Spent recently some ti=
me to model object oriented programming in C with macros. Defined some macr=
os and defined kind of "mixins" that I could paste both for creating the me=
mbers and the reflection and and and...&nbsp;</div><div><br></div><div>if a=
 mechanism, protocol or whatsoever we would like to call it would be in pla=
ce would be then a small step to create a compiler template.</div><div><br>=
</div><div>class someClass {</div><div><br></div><div>&nbsp; &nbsp;Type1 me=
mber1;</div><div>&nbsp; &nbsp;Type2 member2</div><div><br></div><div>};</di=
v><div>function reflect() {</div><div>&nbsp; &nbsp;print(names&lt;members&g=
t;&lt;someClass&gt; &nbsp; &gt;);</div><div>}</div><div>&nbsp;</div><blockq=
uote class=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-lef=
t: 1px #ccc solid;padding-left: 1ex;"><div dir=3D"ltr"><div>Also I think yo=
u should explain how you intend the toJson() function to be implemented and=
 what information can be extracted from the elements of the members&lt;&gt;=
 template and how this is done. To create the JSON representation you need =
to know the member names at least...</div></div></blockquote><div>Well, did=
 not want to go into details. The toJson() would be some overloaded functio=
n like the "&lt;&lt;" operators for streams.</div><div><br></div><div>let's=
 go back to the example I wrote earlier:<br><br><div>class Person {<br></di=
v><div><div>&nbsp; &nbsp;private:</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nb=
sp;string name;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;int age;</div><=
div>};<br></div><div><br></div><div>void someMethod() {</div><div>&nbsp;</d=
iv><div>&nbsp; &nbsp; Person person =3D getPerson();</div><div>&nbsp; &nbsp=
; toJson( members&lt;Person&gt;(person) );&nbsp;</div><div>}</div></div></d=
iv><div><br></div><div>I use often the same mechanism to trace functions, b=
ut ha</div><div><div>void someMethod(Type1 t1, Type2 t2 /* and so on */) {<=
/div><div>&nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; Trace(t1, t2); &nbsp;=
/* Trace macro can deduce the name of variables*/</div><div>&nbsp; &nbsp; P=
erson person =3D getPerson();</div><div>&nbsp; &nbsp; toJson( members&lt;Pe=
rson&gt;(person) );&nbsp;</div><div>}</div></div><div><br></div><div>Trace =
would expand to something:</div><div><br></div><div>stream &lt;&lt; "{t1=3D=
" &lt;&lt; t1 &lt;&lt; ", t2" &lt;&lt; t2 &lt;&lt; "}" &lt;&lt; endl;</div>=
<div>now with a little syntactic sugare with these "generalized" templates,=
 one should be able to generate such code.<br></div><div><br></div><div>the=
 toJson() would be a family of overloaded methods (templates) that would ju=
st add some json encoding arround values and names.</div><blockquote class=
=3D"gmail_quote" style=3D"margin: 0;margin-left: 0.8ex;border-left: 1px #cc=
c solid;padding-left: 1ex;"><div dir=3D"ltr"><div><br></div><div>I think th=
at your ideas regarding getting the list of "my own" function parameters, l=
ocal variables and globals are new ideas which maybe would be worth adding =
to the reflection system. Globals seems quite scary though, thousands of te=
mplate parameters in some cases...</div></div></blockquote><div><br></div><=
div>what about reconsidering reflection system and extend the language to b=
e able to create scripts that would access the compiler knowledge. I think =
would be a big step for several problems. I think lot of effort is wasted b=
y trying to be backword compatible. Also c++ compiler is becoming very very=
 slow because the language tried to be backward compatible etc.</div><div>&=
nbsp;</div><div>Well, when I said globals, I was thinking about variables a=
nd not everything. But why not inventing a way, a syntax where one could se=
lect stuff from the current context/namespace. Say:</div><div><br></div><di=
v>paste&lt;type=3D"variable" scope=3D"local" regex=3D"blahblah'&gt; etc.</d=
iv><div><br></div><div>If this would gain attention, would be happy to spen=
d time to formalize it a bit more.</div><div><br></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&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
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_511_1853760386.1422840227427--
------=_Part_510_939881953.1422840227427--

.


Author: mobiphil <mobi@mobiphil.com>
Date: Sun, 1 Feb 2015 18:07:03 -0800 (PST)
Raw View
------=_Part_3057_1913693769.1422842823881
Content-Type: multipart/alternative;
 boundary="----=_Part_3058_588594464.1422842823881"

------=_Part_3058_588594464.1422842823881
Content-Type: text/plain; charset=UTF-8

(please read previous posts)
what about compile time c++ embedded in code that would be evaluated at
compile time and will manipulate the AST?

keyword: macro
syntax:
macro {
/* any valid c++ code that would be valid inside a block (non global scope)
 */
};



/* example: */


macro {
   void pasteMembers(Class c) {
           for( for m: c.members() ) {
                    paste(m.type(), " ", m.name(), ";" );
           }
    }
};


macro {
   void pasteTrace(Object o) {
           paste("cout << ");
           for( m: o.type().members() ) {
                    paste("\"", m.name(), "\"=", o.name(), ".", m.name() );

           }
    }
};


/* a normal class */
class A {
  int i;
  string s;
};



class B {
  macro {pasteMembers(A);}
}; /* bit of nonsense, create a class B identical with A */


void aFunction(A a) {
  macro { pasteTrace(a) }
}

void anotherFunction(A a, B b, C c /* etc*/) {
  macro { paste(getArguments()) } /* get arguments retreives the arguments
of the function "library function"*/
}

etc...




--

---
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_3058_588594464.1422842823881
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">(please read previous posts)<div>what about compile time c=
++ embedded in code that would be evaluated at compile time and will manipu=
late the AST?&nbsp;</div><div><br></div><div class=3D"prettyprint" style=3D=
"border: 1px solid rgb(187, 187, 187); word-wrap: break-word; background-co=
lor: rgb(250, 250, 250);"><code class=3D"prettyprint"><div class=3D"subpret=
typrint"><span style=3D"color: #000;" class=3D"styled-by-prettify">keyword<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">:</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify"> macro<br>syntax</sp=
an><span style=3D"color: #660;" class=3D"styled-by-prettify">:</span><span =
style=3D"color: #000;" class=3D"styled-by-prettify"> <br>macro </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">/* any valid c++ code that would be v=
alid inside a block (non global scope) &nbsp;*/</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><br><br></span><span style=3D"color: #800;"=
 class=3D"styled-by-prettify">/* example: */</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"><br><br><br>macro </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>&nbsp; &nbsp;</span><span style=3D"col=
or: #008;" class=3D"styled-by-prettify">void</span><span style=3D"color: #0=
00;" class=3D"styled-by-prettify"> pasteMembers</span><span style=3D"color:=
 #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #606;" c=
lass=3D"styled-by-prettify">Class</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> c</span><span style=3D"color: #660;" class=3D"styl=
ed-by-prettify">)</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">{<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; =
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">for</span><span style=3D"color: #660;" class=3D"sty=
led-by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-pr=
ettify"> </span><span style=3D"color: #008;" class=3D"styled-by-prettify">f=
or</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> m</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">:</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify"> c</span><span style=3D"c=
olor: #660;" class=3D"styled-by-prettify">.</span><span style=3D"color: #00=
0;" class=3D"styled-by-prettify">members</span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">()</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"style=
d-by-prettify">)</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> </span><span style=3D"color: #660;" class=3D"styled-by-prettify">{</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &=
nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; paste</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">(</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify">m</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">.</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify">type</span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">(),</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> </span><span style=3D"color: #080;" class=3D"styled-by-pr=
ettify">" "</span><span style=3D"color: #660;" class=3D"styled-by-prettify"=
>,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> m</span=
><span style=3D"color: #660;" class=3D"styled-by-prettify">.</span><span st=
yle=3D"color: #000;" class=3D"styled-by-prettify">name</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">(),</span><span style=3D"color:=
 #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #080;" c=
lass=3D"styled-by-prettify">";"</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">);</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy"><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">}</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"><br>&nbsp; &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"styl=
ed-by-prettify"><br><br><br>macro </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br>&nbsp; &nbsp;</span><span style=3D"color: #008;" class=
=3D"styled-by-prettify">void</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> pasteTrace</span><span style=3D"color: #660;" class=3D"s=
tyled-by-prettify">(</span><span style=3D"color: #606;" class=3D"styled-by-=
prettify">Object</span><span style=3D"color: #000;" class=3D"styled-by-pret=
tify"> o</span><span style=3D"color: #660;" class=3D"styled-by-prettify">)<=
/span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span style=
=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; &nbsp; &nbsp; &nb=
sp; &nbsp; &nbsp;paste</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">(</span><span style=3D"color: #080;" class=3D"styled-by-prettif=
y">"cout &lt;&lt; "</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">);</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</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;" class=3D"=
styled-by-prettify"> m</span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">:</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"> o</span><span style=3D"color: #660;" class=3D"styled-by-prettify">.</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify">type</span><sp=
an style=3D"color: #660;" class=3D"styled-by-prettify">().</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify">members</span><span style=
=3D"color: #660;" class=3D"styled-by-prettify">()</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;"=
 class=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-b=
y-prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettif=
y"><br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp=
; paste</span><span style=3D"color: #660;" class=3D"styled-by-prettify">(</=
span><span style=3D"color: #080;" class=3D"styled-by-prettify">"\""</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> m</span><span style=3D"col=
or: #660;" class=3D"styled-by-prettify">.</span><span style=3D"color: #000;=
" class=3D"styled-by-prettify">name</span><span style=3D"color: #660;" clas=
s=3D"styled-by-prettify">(),</span><span style=3D"color: #000;" class=3D"st=
yled-by-prettify"> </span><span style=3D"color: #080;" class=3D"styled-by-p=
rettify">"\"=3D"</span><span style=3D"color: #660;" class=3D"styled-by-pret=
tify">,</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> o<=
/span><span style=3D"color: #660;" class=3D"styled-by-prettify">.</span><sp=
an style=3D"color: #000;" class=3D"styled-by-prettify">name</span><span sty=
le=3D"color: #660;" class=3D"styled-by-prettify">(),</span><span style=3D"c=
olor: #000;" class=3D"styled-by-prettify"> </span><span style=3D"color: #08=
0;" class=3D"styled-by-prettify">"."</span><span style=3D"color: #660;" cla=
ss=3D"styled-by-prettify">,</span><span style=3D"color: #000;" class=3D"sty=
led-by-prettify"> m</span><span style=3D"color: #660;" class=3D"styled-by-p=
rettify">.</span><span style=3D"color: #000;" class=3D"styled-by-prettify">=
name</span><span style=3D"color: #660;" class=3D"styled-by-prettify">()</sp=
an><span style=3D"color: #000;" class=3D"styled-by-prettify"> </span><span =
style=3D"color: #660;" class=3D"styled-by-prettify">);</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"><br><br>&nbsp; &nbsp; &nbsp; &n=
bsp; &nbsp; &nbsp;</span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">}</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><=
br>&nbsp; &nbsp; </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><br><br></sp=
an><span style=3D"color: #800;" class=3D"styled-by-prettify">/* a normal cl=
ass */</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br>=
</span><span style=3D"color: #008;" class=3D"styled-by-prettify">class</spa=
n><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>&nbsp; </span><span style=
=3D"color: #008;" class=3D"styled-by-prettify">int</span><span style=3D"col=
or: #000;" class=3D"styled-by-prettify"> i</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;" clas=
s=3D"styled-by-prettify">string</span><span style=3D"color: #000;" class=3D=
"styled-by-prettify"> s</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: #660;" class=3D"styled-by-prettify">};=
</span><span style=3D"color: #000;" class=3D"styled-by-prettify"><br><br><b=
r><br></span><span style=3D"color: #008;" class=3D"styled-by-prettify">clas=
s</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 st=
yle=3D"color: #000;" class=3D"styled-by-prettify"><br>&nbsp; macro </span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">{</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify">pasteMembers</span><span st=
yle=3D"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"co=
lor: #000;" class=3D"styled-by-prettify">A</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: #660;" class=3D"s=
tyled-by-prettify">};</span><span style=3D"color: #000;" class=3D"styled-by=
-prettify"> </span><span style=3D"color: #800;" class=3D"styled-by-prettify=
">/* bit of nonsense, create a class B identical with A */</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"><br><br><br></span><span st=
yle=3D"color: #008;" class=3D"styled-by-prettify">void</span><span style=3D=
"color: #000;" class=3D"styled-by-prettify"> aFunction</span><span style=3D=
"color: #660;" class=3D"styled-by-prettify">(</span><span style=3D"color: #=
000;" class=3D"styled-by-prettify">A a</span><span style=3D"color: #660;" c=
lass=3D"styled-by-prettify">)</span><span style=3D"color: #000;" class=3D"s=
tyled-by-prettify"> </span><span style=3D"color: #660;" class=3D"styled-by-=
prettify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"=
><br>&nbsp; macro </span><span style=3D"color: #660;" class=3D"styled-by-pr=
ettify">{</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> =
pasteTrace</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 styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> </span><span style=3D"colo=
r: #660;" class=3D"styled-by-prettify">}</span><span style=3D"color: #000;"=
 class=3D"styled-by-prettify"><br></span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br><br></span><span style=3D"color: #008;" class=3D"styled-=
by-prettify">void</span><span style=3D"color: #000;" class=3D"styled-by-pre=
ttify"> anotherFunction</span><span style=3D"color: #660;" class=3D"styled-=
by-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-pretti=
fy">A a</span><span style=3D"color: #660;" class=3D"styled-by-prettify">,</=
span><span style=3D"color: #000;" class=3D"styled-by-prettify"> B b</span><=
span style=3D"color: #660;" class=3D"styled-by-prettify">,</span><span styl=
e=3D"color: #000;" class=3D"styled-by-prettify"> C c </span><span style=3D"=
color: #800;" class=3D"styled-by-prettify">/* etc*/</span><span style=3D"co=
lor: #660;" class=3D"styled-by-prettify">)</span><span style=3D"color: #000=
;" class=3D"styled-by-prettify"> </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"><br>&nbsp; macro </span><span style=3D"color: #660;" class=
=3D"styled-by-prettify">{</span><span style=3D"color: #000;" class=3D"style=
d-by-prettify"> paste</span><span style=3D"color: #660;" class=3D"styled-by=
-prettify">(</span><span style=3D"color: #000;" class=3D"styled-by-prettify=
">getArguments</span><span style=3D"color: #660;" class=3D"styled-by-pretti=
fy">())</span><span style=3D"color: #000;" class=3D"styled-by-prettify"> </=
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">/* get arguments retreives t=
he arguments of the function "library function"*/</span><span style=3D"colo=
r: #000;" class=3D"styled-by-prettify"><br></span><span style=3D"color: #66=
0;" class=3D"styled-by-prettify">}</span><span style=3D"color: #000;" class=
=3D"styled-by-prettify"><br><br>etc</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><br><br></span></div></code></div><div><br><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&quot; group.<br />
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to <a href=3D"mailto:std-proposals+unsubscribe@isocpp.org">std-proposa=
ls+unsubscribe@isocpp.org</a>.<br />
To post to this group, send email to <a href=3D"mailto:std-proposals@isocpp=
..org">std-proposals@isocpp.org</a>.<br />
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_3058_588594464.1422842823881--
------=_Part_3057_1913693769.1422842823881--

.