Re: On the benefits of reflection

Massimo Del Zotto <[email protected]> Wed, 20 Mar 2013 07:48:45 +0100
Newsgroups gmane.games.devel.sweng
Message-ID <CALWCaoaBwRcD=Y2mQNp4kuZ5jTi_s=7WJ-v3uPkrMvEAiKCn=g@mail.gmail.com>
--===============1541623270==
Content-Type: multipart/alternative; boundary=f46d0444ebbf14116604d8559d4d

--f46d0444ebbf14116604d8559d4d
Content-Type: text/plain; charset=ISO-8859-1

My question regards the goal I'm targeting. When something is worth, I can
perceive a strong set of goals "opening" at a lower effort. I don't have
that feel with reflection. I am not really able to pull out the exact
question synthethizing my doubts but I hope I will be able to explain
myself with various comments.

So from reflection we're obviously able to enumerate the fields of any
type, get the type of field, its attributes, and from reflection and
invoking, we can modify the field and notify the class of changes from
editor-side only if needed.  Those attributes and notification methods can
easily be compiled away in final builds if need be.

The texture example does not fit my likings at all, perhaps I'm stuck in a
old-school reflection line of thinking but it looks to me it would be much
nicer using a component based system. Do component based systems qualify as
reflective systems?

Reflection can tell us what needs to save to disk or what needs to be
serialized over the network.  Sure you can write your own Read/Write code
(and we did in the past), but that gets messy and is just another copy of
the information (fields) that you've already entered somewhere else.  And
sure, you could have a compiler generate a Read/Write function for you, but
changing/updating that code then requires changing the compiler and
recompiling your entire code base.

No, if using suballocators (like ID did in the Quake series). In UDK
UnrealScript (which has bland reflection capabilities as far as I recall)
has special annotations to let the native core understand if something is
going to survive serialization or not. Being VM-based, UDK probably
serializes in a way similar to VM.

And for us, there's also a small amount of reflection needed for our
garbage collector...

I want to repeat my first message. There's something "reflective" already
going on in my native C++ core.
One of the question regards providing reflective features to the language.
As for the native core:

   - My GC inspects objects, as every GC does. I wouldn't call it
   reflection (we just need the pointers).
   - I have something which might appear blandly reflective in the
   component system. However, I don't inspect anything for having components
   inside, I just know it when it happens.


As a side note, my core C++ system has no notion of any gameplay-specific
concept so specific examples are fine but try to keep it in perspective.

I appreciate your effort a lot.

Massimo

--f46d0444ebbf14116604d8559d4d
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

My question regards the goal I&#39;m targeting. When something is worth, I =
can perceive a strong set of goals &quot;opening&quot; at a lower effort. I=
 don&#39;t have that feel with reflection. I am not really able to pull out=
 the exact question synthethizing my doubts but I hope I will be able to ex=
plain myself with various comments.<div>
<br></div><blockquote style=3D"margin:0 0 0 40px;border:none;padding:0px"><=
div><span style=3D"color:rgb(34,34,34);font-family:arial,sans-serif;font-si=
ze:13px;background-color:rgb(255,255,255)">So from reflection we&#39;re obv=
iously able to enumerate the fields of any type, get the type of field, its=
 attributes, and from reflection and invoking, we can modify the field and =
notify the class of changes from editor-side only if needed. =A0Those attri=
butes and notification methods can easily be compiled away in final builds =
if need be.</span></div>
</blockquote><div><div>The texture example does not fit my likings at all, =
perhaps I&#39;m stuck in a old-school reflection line of thinking but it lo=
oks to me it would be much nicer using a component based system. Do compone=
nt based systems qualify as reflective systems?</div>
</div><div><br></div><blockquote style=3D"margin:0 0 0 40px;border:none;pad=
ding:0px"><div><div style=3D"color:rgb(34,34,34);font-family:arial,sans-ser=
if;font-size:13px;background-color:rgb(255,255,255)">Reflection can tell us=
 what needs to save to disk or what needs to be serialized over the network=
. =A0Sure you can write your own Read/Write code (and we did in the past), =
but that gets messy and is just another copy of the information (fields) th=
at you&#39;ve already entered somewhere else. =A0And sure, you could have a=
 compiler generate a Read/Write function for you, but changing/updating tha=
t code then requires changing the compiler and recompiling your entire code=
 base.</div>
</div></blockquote><div>No, if using suballocators (like ID did in the Quak=
e series). In UDK UnrealScript (which has bland reflection capabilities as =
far as I recall) has special annotations to let the native core understand =
if something is going to survive serialization or not. Being VM-based, UDK =
probably serializes in a way similar to VM.</div>
<div><br></div><div><blockquote style=3D"margin:0 0 0 40px;border:none;padd=
ing:0px"><div><div style=3D"color:rgb(34,34,34);font-family:arial,sans-seri=
f;font-size:13px;background-color:rgb(255,255,255)">And for us, there&#39;s=
 also a small amount of reflection needed for our garbage collector...</div=
>
</div></blockquote></div><div>I want to repeat my first message. There&#39;=
s something &quot;reflective&quot; already going on in my native C++ core.<=
/div><div>One of the question regards providing reflective features to the =
language.</div>
<div>As for the native core:</div><div><ul><li>My GC inspects objects, as e=
very GC does. I wouldn&#39;t call it reflection (we just need the pointers)=
.</li><li>I have something which might appear blandly reflective in the com=
ponent system. However, I don&#39;t inspect anything for having components =
inside, I just know it when it happens.</li>
</ul><div><br></div></div><div>As a side note, my core C++ system has no no=
tion of any gameplay-specific concept so specific examples are fine but try=
 to keep it in perspective.</div><div><br></div><div>I appreciate your effo=
rt a lot.</div>
<div><br></div><div>Massimo</div>

--f46d0444ebbf14116604d8559d4d--

--===============1541623270==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

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

--===============1541623270==--