I have read the new spec, and I have one more question. With the new model, 
most collections in the stdlib will be written to use sink paramaters and take 
ownership of the objects that they contain.

Many algorithms require to keep the same object in more than one collection at 
a time. For example, say I have a `seq[T]` and want to split it according to 
whether an item appears an even or an odd number of times. In the current Nim 
language, I woudl write it like this
    
    
    proc split(things: seq[T]): tuple[even, odd: seq[T]] =
      var counter = newTableCount[T]()
      for thing in things:
        inc(counter[thing])
      for thing, count in counter:
        if count mod 2 == 0:
          result.even.add(thing)
        else:
          result.odd.add(thing)
    
    
    Run

How would this work with the new runtime when T is a ref type? I need `thing` 
to be at the same time in the original sequence and as keys in the count table. 
Next, I need to move all these items from the count table to their destination: 
do I need some form of iteration that consumes items in the table?

Even if this is doable with the new runtime: will this be doable in a generic 
fashion, as above, or will I need two different implementations, for ref types 
and non ref types?

Reply via email to