On Wednesday, 23 September 2020 at 20:19:04 UTC, data pulverizer wrote:
Thinking more about it this ...

class Middle: Node
{
  Node prev;
  Node next;
}
won't work because the I've told the compiler that the static type is "Node", my original design was something like this:

```
struct Middle(P, N)
{
  P prev;
  N next;
}
```

which also won't work because it can't actually be instantiated (recursive), and the start and end nodes must be different types (and you can't substitute the middle node for the start and end node). It's the simplest case because there could be more than one type of middle node. More generally, correct me if I'm wrong, but I don't think these kinds of statically multityped tree structures can be formed in static languages so I've been using tuples - at least for the simple case I outlined.

Reply via email to