Thanks, I'll have a look at wrapping `alloca`, but I am pessimistic:
The problem arose when I tried to return a _seq_ within a parallel for loop. I fear (currently) a **parallel for loop** doesn't work with custom types. Here is a slightly modified version of an example given by _ynfle_ which fails to compile import strutils, math, threadpool type Coeff = object c: array[1,float] proc term(k: int): Coeff = result = Coeff(c: [(if (k and 1) == 0 : 1.0 else: -1.0) * 4.0/(float(k+k) + 1.0)]) proc pi(n: int): float = var ch = newSeq[FlowVar[Coeff]](n+1) {.push experimental: "parallel".} parallel: for k in 0..ch.high: ch[k] = spawn term(k) # type mismatch: got 'Coeff' for 'spawn term(k), nimCreateFlowVar' but expected 'FlowVar[Vx.Coeff]' for k in 0..ch.high: result += (^ch[k]).c[0] {.pop.} echo formatFloat(pi(5000)) Run