3 ms·
For a statically-compiled languages, I don't see why people would prefer runtime reflection to compile-time code generation. You can reduce code duplication, b
by rwj 10y ago
For 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.
- billq 10y agoIt is because you can do all sorts of nice things in a data driven way. E.g. your reflected code might expose a load of objects and behaviours. At runtime you could load a data file which contains information to create objects, and hook up the behaviour. Loading (and reloading) scripts or data files can be significantly faster than recompiling a large game. It also allows non-programmers to contribute.