Generally speaking, whenever you are using `if v of SomeType`, you are holding 
it wrong. Polymorphism gives you the power of defining dispatching methods for 
operations whose implementation differs based on which subtype your variable 
holds.

If implementing your code with dispatching methods seems clumsy or simply does 
not fit your coding style, use object variants instead. The question of whether 
the values should reside on the stack or on the heap is a different one. For 
example, [JsonNode](http://nim-lang.org/docs/json.html#JsonNode) is an object 
with variants but also a `ref` type residing on the heap.

Reply via email to