On 2013-11-13 23:25, deadalnix wrote:
OK, I see your problem here.
It is a much more general problem than the one solved by the factory.
For instance, I wanted in the past to write some unittest that ensure
Liskov's substitution principle (so run the unittest on subclasses).
This is fundamentally the same issue : you want to write some code that
is aware of subclasses. That require somehow to be able to mixin
something automatically in all subclasses.
Might be solveable with AST macros :). Although you can still have
problems with subclasses you don't know of during compile time. Doing
separate compilation, libraries and so on.
Object.factory only solve poorly one instance of this problem.
--
/Jacob Carlborg