On Mon, Jan 12, 2015 at 1:07 AM, Vicente J. Botet Escriba < vicente.botet@wanadoo.fr> wrote:
As I said I don't know nothing about the Games domain. It is more a principle I want to follow, prefer compile-time check, then link time and the run-time.
It is not a game-domain-specific issue, you shouldn't focus on this. It's useful as soon as you want to modelize a context where entites do not all have the same properties (physical, behavioral, etc.). It's even useful to replace inheritance when modelizing a company employees. Compile checks just goes half against the advantages of a component system: - easy paralellize processing when possible; - faster batch processing by type or for all component instances; - easy runtime composition and extensibility; Usually trying to call a function in a component which don't exist for an entity will not do anything at all, maybe report a warning or something. You want to add a constraint. I'm not sure if it is: 1. All component types are checked at compile time see if they are compatible. 2. All component of an entity are checked at compile time see if they are allowed and compatible. I think both constraints can be added over a run-time checked component system, I just never tried to do so but that must be an interesting exercise.