Re: Error creating a template

2016-07-25 Thread Garry_Galler
**OderWat** Great! Maybe **Araq** will want to include in the next build something like that? :) Personally I would not mind.

Re: Error creating a template

2016-07-25 Thread OderWat
Works for me... # nim c --threads:on -d:release --verbosity:0 {.experimental.} import times import threadpool proc enumerableRepeat[T](value: T, n: int = -1): iterator(): T {.gcsafe.} = result = iterator(): T {.closure.} = var i = 0

Re: Error creating a template

2016-07-25 Thread Garry_Galler
Thank you very much for your help :) With the pragma {.closure.} now you can use the external variables in the template. But when you try to use my previous function (_writeFile_ from this thread [writeFile with iterator](http://forum.nim-lang.org///forum.nim-lang.org/t/2403)) pa

Re: Error creating a template

2016-07-25 Thread OderWat
You could not use the global GC value of "w" in a thread. So you have to make that const first of all. Then going back to "basic" coding. This works: # nim c --threads:on -d:release {.experimental.} import times import threadpool const w = ["aa

Error creating a template

2016-07-24 Thread Garry_Galler
{.experimental.} import times import threadpool import future let w = ["aa", "bb","cc"] template parallelFor( slice: Slice[int], f:expr ) = const a = slice.a