"I made up the term 'object-oriented', and I can tell you I didn't have C++ in mind" Alan Kay (inventor of Smalltalk)
Reflection in C++
31–40 of 40 posts
Re: Reflection in C++
#32Earlier quoted context omitted.
There are two reasons: * If you use std::vector , std::vector and std::vector you will (probably) end up with three instantiations of std::vector ("probably" because the implementation has some leeway). This it no different than what you would get if you implemented std::vector with macros or by hand, but for some reason people like to count it as code bloat. * Modern compilers have a tendency to instantiate the same…
>>but for some reason people like to count it as code bloat Again, used code being generated is counted as bloat. This, I can't understand.
Re: Reflection in C++
#33Most applications use an embedded interpreter to do runtime inspection and modification. The tools for the job is usually lua/python. Creating your own type system seems like a bad idea.
Re: Reflection in C++
#34Can someone please clarify: "What is Reflection? A reflection API is a very basic, powerful tool that every game studio should have at their disposal. It normally contains some or all of the following features: ..." This doesn't actually tell me what reflection is. Telling me what it normally contains or that its something that every game studio should have does not explain the concept. Could someone someone please e…
Reflection is the concept of having a program have knowledge about it's own structure. Kinda like having your code look into a mirror. A really basic example of this is having you code get a list of all the names of fields of a class. This would be very useful if you want to create a generic object serializer. In the past I used this to create a framework that would generate a UI for you based on class definitions. R…
Re: Reflection in C++
#35Earlier quoted context omitted.
There are two reasons: * If you use std::vector , std::vector and std::vector you will (probably) end up with three instantiations of std::vector ("probably" because the implementation has some leeway). This it no different than what you would get if you implemented std::vector with macros or by hand, but for some reason people like to count it as code bloat. * Modern compilers have a tendency to instantiate the same…
This it no different than what you would get if you implemented std::vector with macros or by hand, but for some reason people like to count it as code bloat. Not if you implement it as a resizeable array of bytes, which is what a lot of the std::vector-ish structures I see being used in C are. There's just one set of functions which work with different element sizes, not a set of nearly-identical ones for each eleme…
Re: Reflection in C++
#36Re: Reflection in C++
#37For a statically-compiled languages, I don't see why people would prefer runtime reflection to compile-time code generation. You can reduce code duplication, but at the expense of runtime speed. But if that was the use case, I'm not certain why you would be using C++ to begin with.
Re: Reflection in C++
#38"is a bad idea".
In game development it tends to help solve some common problems. Games need a lot of iteration, C++ compile times can easily get very long i.e. minutes. You might object that compile times should never be long: "oh this never happens if you do X or Y" but in reality every C++ gamedev shop I've worked at has had long compiles times. Templates and other things of that nature tend to bloat it. Anyway so reflection helps…
I'm not interested in exposing everything in an executable. I see that as unnecessary. I just want the relevant objects exposed in a useful way.
Re: Reflection in C++
#39http://xmlrpc-c.sourceforge.net/ is a real world implementation
Re: Reflection in C++
#40Earlier quoted context omitted.
Wouldn't you prefer to generate type-safe bindings at compile-time?
Definitely. That's why I'm to hyped for compile-time reflection in C++: http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2016/ (search for "reflection")