> What do you mean? I don't know what I mean anymore. I tried this though: import taskpools,cpuinfo template taskPoolsAs(pool,codeBlock:untyped) = var pool = Taskpool.new(num_threads = countProcessors()) codeBlock pool.syncAll pool.shutdown proc move*(hypothetical:Hypothetic,dice:openArray[int]):Move = taskPoolsAs tp: var flowMoves:seq[FlowVar[Move]] for pieceNr,fromSquare in hypothetical.pieces: if fromSquare != 0 or hypothetical.cash >= piecePrice: for i in dice.low..dice.high: flowMoves.add tp.spawn hypothetical.bestMove(pieceNr,fromSquare,dice[i]) result = flowMoves.map(it => sync it).sortedByIt(it.eval)[^1] Run
It works, but it feels shaky: I cannot use: for die in die: because die becomes void - I suspect the macro Also I receive a host of warnings and hints from the compiler, such as: D:\Nim\nim-2.0.6\lib\std\isolation.nim(29, 13) Warning: `=destroy`(dest.value) can raise an unlisted exception: Exception [Effect] C:\Users\perni\.nimble\pkgs2\taskpools-0.0.4-e43c5170d4e9ef1b27dd0956ffa0db46f992f9a6\taskpools\channels_spsc_single.nim(52, 1) Hint: 'tryRecv' cannot raise 'AssertionDefect' [XCannotRaiseY] C:\Users\perni\.nimble\pkgs2\taskpools-0.0.4-e43c5170d4e9ef1b27dd0956ffa0db46f992f9a6\taskpools\channels_spsc_single.nim(68, 1) Hint: 'trySend' cannot raise 'AssertionDefect' [XCannotRaiseY] Run