> With Stage as a ref type instead, the seq is an array of pointers under the 
> hood

So, if we have something like
    
    
    type
      SomeObj = object
         ...
    var someSeq = seq[SomeObj]
    
    
    Run

then
    
    
    var obj = SomeObj()
    someSeq.add(obj)
    
    
    Run

will add the object _itself_ to the sequence.

But if we have
    
    
    type
      SomeObj = ref object
         ...
    var someSeq = seq[SomeObj]
    
    
    Run

then
    
    
    var obj = SomeObj()
    someSeq.add(obj)
    
    
    Run

will

  * (automatically) allocate `obj` on the heap
  * add a _pointer_ to allocated object to the sequence



Right?

BTW, did I get it right that `seq` is a nim's synonym for, say, D's 'dynamic 
array'? 

Reply via email to