Sorry Stefan, my original question was indeed lacking background info of what I 
am actually trying to achieve.

I'm trying to port a data model which was originally implemented in Lua to Nim. 
This consists of a tree of nodes, of which the leaves are heterogenous 
containers for a relatively large number of types. (tens, and growing)

My first implementation used object hierarchies, but I ran unto problems caused 
by mixing generics and multimethods. Araq explained that combining those is 
currently not a good idea, so I am looking for a way to drop the methods. Using 
object variants turned out to be cumbersome, so I am now back for a second try 
using object inheritance.

This basically works now, but I find myself writing long case statements 
handling all the possible object types in a few places, so I am looking to 
generalize things to avoid code repetition.

I will try to compile a compact example of my current implementation for 
comments.

Reply via email to