Even though new concepts exist I find they have many jagged edges as they're a 
even less used than their old style counterparts. I imagine the `proc +(a, b: 
T): T` is the problem here but I did not check. A working implementation that 
uses the new style concepts is the following.
    
    
    type
      Addable = concept
        proc `+`(x, y: Self): Self
      
      Coll[T] = concept
        iterator items(x: Self): T
      
      AddableColl[T: Addable] = Coll[T]
    
    proc sum[T](nums: AddableColl[T]): T =
      for num in nums.items:
        result += num
    
    echo @[0, 1, 2].sum
    
    
    Run

Reply via email to