I want to be able to inherit from GenericNode and GenericEdge, so I can add 
arbitrary fields to them.

I could add a generic `payload: T` field instead (and put all extra fields 
there), but that means I would need to write `node.payload.someExtraNodeField` 
each time I want to access it (and also it would require extra memory).

Although I just realized that instantiating a generic type and inheriting from 
it at the same time is another thing that probably just isn't possible:
    
    
    type
      GenericNode[E] = ref object of RootObj
        someEdge: E
      
      GenericEdge[N] = ref object of RootObj
        someNode: N
    
    type
      Node = ref object of GenericNode[Edge]:
        someExtraNodeField: int
      Edge = ref object of GenericEdge[Node]:
        someExtraEdgeField: int
    
    
    Run

Reply via email to