The problem with inheritance is that my base algorithm (operating on 
`BaseNode`/`BaseEdge`) should be able to create instances of them without 
knowing about the exact descendants.

For now I decided just to pass "constructors" (procs which return instances of 
base objects) to that algorithm.

Another problem is that the base algorithm returns a `Graph` object, which in 
turn contains lists of `BaseNode`/`BaseEdge`. So if I want to access extra 
fields in those nodes and edges, I need to write something like 
`myNode(graph.nodes[0]).extraNodeField = 123` (i.e. type conversion is 
required).

But you're right, using procs and templates to reduce that boilerplate seems 
more reasonable idea than generics.

Reply via email to