Thank you!

Yeah you got the idea! Compiler doesn't allow to redefine a proc/method in the 
same module, however **redefinition across modules compiles fine**. I wanted to 
use this trick to allow users redefine my library methods in their code - just 
like that kill in main.nim. It is much simpler than using inheritance or other 
methods to inject user-defined code - just use internal dispatch trees that 
will do all redefinition job for you 

Undefined behaviour here is really undefined. What made me curious is that 
definition order is always the same (kill from main.nim is always defined 
last), but dispatch depends on other non-related methods which is 
counter-intuitive...

P.S. Thanks for var notice. Actually it is a part of a larger codebase where 
the reassignment really happens. I just omitted some unnecessary code.

Reply via email to