> So, what I basically want to know is if what I wrote is valid and sound Nim 
> code.

It is valid code. However:

You don't actually use inheritance in your code for `Fighter` and `Thing`, so 
`of RootObj` and `method` (instead of `proc`) may introduce unnecessary 
overhead, unless you plan on using inheritance later. If you do want to use 
inheritance, then you may want to mark the root objects of your own inheritance 
hierarchy as `{.inheritable.}` instead of inheriting from `RootObj`. Inheriting 
from `RootObj` means that you can assign anything to variables of type 
`RootRef`. This can be useful (e.g. for debugging purposes), but also means 
that you can possibly get types mixed up.

Concepts (in their current form) are somewhat orthogonal to inheritance, as 
they're (currently) for compile-time polymorphism (via generics) instead of 
runtime polymorphism (which is what inheritance is for). Once `vtref` support 
is available, you can then also use them for runtime polymorphism (see the 
manual for details).

Reply via email to