(no subject)

"Jarkko Lempiainen [Profoundic]" <[email protected]> Wed, 16 Jun 2010 15:03:00 -0700 (PDT)
Newsgroups gmane.games.devel.sweng
Message-ID <[email protected]>
8617D035@enfor
	cer.dreamhost.com> <[email protected]>
In-Reply-To: <[email protected]>
Subject: RE: [Sweng-Gamedev] (no subject)
Date: Thu, 17 Jun 2010 01:03:23 +0300
Organization: Profoundic Technologies, Inc.
Message-ID: <001001cb0d9f$c0f20a00$42d61e00$@com>
MIME-Version: 1.0
Content-Type: multipart/alternative;
	boundary="----=_NextPart_000_0011_01CB0DB8.E63F4200"
X-Mailer: Microsoft Office Outlook 12.0
Thread-Index: AcsNiwxoTDpNc1jvRoeDqpO1Vn5i7QAC2jrQ
Content-Language: en-us

This is a multi-part message in MIME format.

------=_NextPart_000_0011_01CB0DB8.E63F4200
Content-Type: text/plain;
	charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

Not using MS Word but Outlook. Don't know what just happened because =
posting here has worked fine before. Hope this post comes through clear. =
Sorry for the mess.

=20

I'm not a big fan of templates for this because it makes member =
declarations & access quite messy. The syntax I have currently looks =
like this:

struct my_reflected_struct

{ PFC_MONO(my_reflected_struct) {PFC_VAR3(a, b, c);}

  int a, b, c;

};

=20

It's not as bad repetition-wise, but there's still repetition of member =
variable names. It hasn't been really an issue for me (have written =
quite a lot of code with this), but it would be nice if you wouldn't =
have to repeat even the names. Probably the most annoying bit is that =
there's no macro ellipsis in C++ standard, so sometimes I forget to =
change the number in the macro for declaration, but at least I get a =
compiler warning then. Something like what you described would be nice =
to be able to query from a type in compile-time, with maybe a bit less =
obscuring syntax. And standard enum/class type and enum value names as =
well for proper serialization & exposure in an editor.

=20

=20

Cheers, Jarkko

=20

=20

From: [email protected] =
[mailto:[email protected]] On Behalf Of Jon =
Watte
Sent: Wednesday, June 16, 2010 10:35 PM
To: [email protected]
Subject: Re: [Sweng-Gamedev] (no subject)

=20

=20

First, you might want to not use MS Word for e-mail to this list -- it =
screws up the text pretty horribly.

=20

Second, that request is akin to the request of custom cv-quals, which is =
another peeve I've had with C++, which would make expressing certain =
things about your code easier. For now, you can kind-of emulate some of =
the use cases by wrapping in property templates.

=20

If instead of "const" you could also declare a cv-qual named, say, =
"main_thread_only," then you could declare variables as:

=20

main_thread_only int foo;

=20

just like you declare:

=20

const int foo;

=20

For now, you have to emulate it with templates:

=20

thread_access<int, main_thread_only> foo;

=20

(There's also the question about how the compiler and code can =
co-operate to enforce whatever semantics you want to tie into your =
custom cv-qual)

=20

Anyway, you can probably use this idea to make the variables you care =
about "marked" already:

=20

networkable<editable<int> > someCount;

=20

The reason you'd still need static reflection, rather than just do it =
all with templates as-is, is that the language has no way for a member =
to discover its context/container. There's a lot of typing to make that =
doable:

=20

struct MyReflectedStruct {

  member<MyReflectedStruct, networkable<editable<int> > > someCount;

  MyReflectedStruct()

    : someCount(this,=20

        networkable<editable<int> >(some_network_queue,=20

        editable<int>("Count of Some things")))

  {

  }

}

=20

There's a lot of repetition there :-(

=20

With more modern annotations and mark-up, that might look something =
like:

=20

  struct MyReflectedStruct {

    struct_member,

    networked(lambda { return some_network_queue; }),

    editable("Count of Some things")

      int someCount;

  }

=20

Look, ma, no repetition!

=20

C# gets this mostly right with [Attributes]. Java and Python also has =
support for this.

=20

Sincerely,

=20

jw

=20


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

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
xmlns=3D"http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=3DContent-Type content=3D"text/html; charset=3Dutf-8">
<meta name=3DGenerator content=3D"Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Tahoma;
	panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-reply;
	font-family:"Calibri","sans-serif";
	color:#1F497D;}
.MsoChpDefault
	{mso-style-type:export-only;}
@page WordSection1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
	{page:WordSection1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext=3D"edit">
  <o:idmap v:ext=3D"edit" data=3D"1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=3DEN-US link=3Dblue vlink=3Dpurple>

<div class=3DWordSection1>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Not using MS Word but Outlook. Don't know what just =
happened because
posting here has worked fine before. Hope this post comes through clear. =
Sorry
for the mess.<o:p></o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>I'm not a big fan of templates for this because it makes =
member declarations
&amp; access quite messy. The syntax I have currently looks like =
this:<o:p></o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>struct my_reflected_struct<o:p></o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>{ PFC_MONO(my_reflected_struct) {PFC_VAR3(a, b, =
c);}<o:p></o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>=C2=A0 int a, b, c;<o:p></o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>};<o:p></o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>It's not as bad repetition-wise, but there's still =
repetition of
member variable names. It hasn't been really an issue for me (have =
written
quite a lot of code with this), but it would be nice if you wouldn't =
have to repeat
even the names. Probably the most annoying bit is that there's no macro
ellipsis in C++ standard, so sometimes I forget to change the number in =
the
macro for declaration, but at least I get a compiler warning then. =
Something
like what you described would be nice to be able to query from a type in
compile-time, with maybe a bit less obscuring syntax. And standard =
enum/class type
and enum value names as well for proper serialization &amp; exposure in =
an
editor.<o:p></o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Cheers, Jarkko<o:p></o:p></span></p>

<p class=3DMsoNormal><span =
style=3D'font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=3DMsoNormal><a name=3D"_MailEndCompose"><span =
style=3D'font-size:11.0pt;
font-family:"Calibri","sans-serif";color:#1F497D'><o:p>&nbsp;</o:p></span=
></a></p>

<div style=3D'border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt =
0in 0in 0in'>

<p class=3DMsoNormal><b><span =
style=3D'font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span>=
</b><span
style=3D'font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
[email protected]
[mailto:[email protected]] <b>On Behalf Of =
</b>Jon
Watte<br>
<b>Sent:</b> Wednesday, June 16, 2010 10:35 PM<br>
<b>To:</b> [email protected]<br>
<b>Subject:</b> Re: [Sweng-Gamedev] (no subject)<o:p></o:p></span></p>

</div>

<div>

<div>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=3DMsoNormal>First, you might want to not use MS Word for e-mail =
to this
list -- it screws up the text pretty horribly.<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=3DMsoNormal>Second, that request is akin to the request of =
custom
cv-quals, which is another peeve I've had with C++, which would make =
expressing
certain things about your code easier. For now, you can kind-of emulate =
some of
the use cases by wrapping in property templates.<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=3DMsoNormal>If instead of &quot;const&quot; you could also =
declare a
cv-qual named, say, &quot;main_thread_only,&quot; then you could declare
variables as:<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=3DMsoNormal>main_thread_only int foo;<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=3DMsoNormal>just like you declare:<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=3DMsoNormal>const int foo;<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=3DMsoNormal>For now, you have to emulate it with =
templates:<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=3DMsoNormal>thread_access&lt;int, main_thread_only&gt; =
foo;<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=3DMsoNormal>(There's also the question about how the compiler =
and code
can co-operate to enforce whatever semantics you want to tie into your =
custom
cv-qual)<o:p></o:p></p>

</div>

</div>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

<div>

<p class=3DMsoNormal>Anyway, you can probably use this idea to make the =
variables
you care about &quot;marked&quot; already:<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=3DMsoNormal>networkable&lt;editable&lt;int&gt; &gt; =
someCount;<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=3DMsoNormal>The reason you'd still need static reflection, =
rather than
just do it all with templates as-is, is that the language has no way for =
a
member to discover its context/container. There's a lot of typing to =
make that
doable:<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=3DMsoNormal>struct MyReflectedStruct {<o:p></o:p></p>

</div>

<div>

<p =
class=3DMsoNormal>&nbsp;&nbsp;member&lt;MyReflectedStruct,&nbsp;networkab=
le&lt;editable&lt;int&gt;
&gt; &gt; someCount;<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal>&nbsp;&nbsp;MyReflectedStruct()<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal>&nbsp;&nbsp; &nbsp;: =
someCount(this,&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal>&nbsp;&nbsp; &nbsp; &nbsp;
&nbsp;networkable&lt;editable&lt;int&gt; =
&gt;(some_network_queue,&nbsp;<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal>&nbsp;&nbsp; &nbsp; &nbsp; =
&nbsp;editable&lt;int&gt;(&quot;Count
of Some things&quot;)))<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal>&nbsp;&nbsp;{<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal>&nbsp;&nbsp;}<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal>}<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=3DMsoNormal>There's a lot of repetition there =
:-(<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=3DMsoNormal>With more modern annotations and mark-up, that =
might look
something like:<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=3DMsoNormal>&nbsp;&nbsp;struct MyReflectedStruct =
{<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal>&nbsp;&nbsp; &nbsp;struct_member,<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal>&nbsp;&nbsp; &nbsp;networked(lambda { return
some_network_queue; }),<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal>&nbsp;&nbsp; &nbsp;editable(&quot;Count of Some
things&quot;)<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal>&nbsp;&nbsp; &nbsp; &nbsp;int =
someCount;<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal>&nbsp;&nbsp;}<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=3DMsoNormal>Look, ma, no repetition!<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=3DMsoNormal>C# gets this mostly right with [Attributes]. Java =
and Python
also has support for this.<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=3DMsoNormal>Sincerely,<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=3DMsoNormal>jw<o:p></o:p></p>

</div>

<div>

<p class=3DMsoNormal><o:p>&nbsp;</o:p></p>

</div>

</div>

</body>

</html>

------=_NextPart_000_0011_01CB0DB8.E63F4200--

_______________________________________________
Sweng-Gamedev mailing list
[email protected]
http://lists.midnightryder.com/listinfo.cgi/sweng-gamedev-midnightryder.com