`||` - parallel loop iterator. Same as .. but the loop may run in parallel.
Can anybody explain what kind of parallelism is here meant? And how is it supposed to work? In the example below, it works in series.
import strutils
var x=0
for i in 1||1000:
inc x
echo "[$1]=$2" % [$i,$x]
Stumpled upon this. Since this uses #omp parallel for you need to pass -fopenmp to the C compiler. The docs are not very clear about this.
Is the parallel for (system.`||`) really supported or should it be deprecated in it's current form?
As say the docs:
"Note that the compiler maps that to the #pragma omp parallel for construct of OpenMP and as such isn't aware of the parallelism in your code! Be careful! Later versions of || will get proper support by Nim's code generator and GC."
It's inevitable for a very young programming language to have placeholders for features before they are fully baked. (And Nim indeed is still "a very young programming language" in many ways, given its breadth and how few programmers had been involved in the beginning, despite the chronological starting point being 2005.)
Maybe the docs just need more emphasis: "HERE BE DRAGONS" ;)