{.experimental.}
    
    import times
    import threadpool
    import future
    
    let w = ["aaaaaaaaaa", "bbbbbbbbbb","cccccccccc"]
    
    template parallelFor(
                      slice: Slice[int],
                      f:expr
                      ) =
      const a = slice.a
      const b = slice.b
      parallel:
        for i in a..b: spawn f(i)
    

It works 
    
    
    parallelFor 0..2, (i:int) =>  echo i

This does not work: Error: cannot prove: i <= 2 (bounds check) 
    
    
    parallelFor 0..2, (i:int) =>  echo w[i]

Using pragma {.boundChecks: off.} does not help. How to write the code 
correctly?

Reply via email to