proc runParent*[TArg,TResult](arg: TArg): Future[TResult] {.async.} =
var retFuture = asyncdispatch.newFuture[TResult]("multiproc.runParent")
var call_result: TResult = ...
asyncdispatch.complete(retFuture, call_result)
return retFuture
lib/pure/asyncmacro.nim(308, 7) Hint: Processing runParent as an async proc. [User]
main.nim(15, 40) template/generic instantiation from here
multiproc.nim(137, 3) Warning: shadowed identifier: 'result' [ShadowIdent]
main.nim(15, 40) template/generic instantiation from here
multiproc.nim(158, 10) Error: type mismatch: got (Future[system.int], Future[system.int])
return retFuture
^
Apparently, if I add {.async.}, then I must treat result as type T instead of type Future[T]. But I still get error (plus the same ShadowIndent warning):
multiproc.nim(141, 3) Warning: shadowed identifier: 'result' [ShadowIdent]
main.nim(15, 40) template/generic instantiation from here
lib/pure/asyncmacro.nim(41, 25) Error: attempting to call undeclared routine: 'callback='
next.callback = cb
Oh. In switching to {.async.}, I need some other symbols from asyncdispatch. I usually try:
from asyncdispath import nil
But a normal (namespace-polluting) import makes my example work fine.
Nvm.