Closed gmega closed 2 weeks ago
at which point this seems to be missing a call to await?
Yes, proc aProc() {.async.} = echo "hello"
transforms the signature into proc aProc(): Future[void] = ...
, so all async
annotations need to be either awaited or discarded.
As a side note, this code as it is now is pretty strange even when it compiles as the Future won't ever be set as a return value as the expansion of wrap does not call setResult:
I suspect that that is not the full transpiled code, must be missing something.
As part of our V4 migration strategy we've been investigating using the V3 "compatibility" mode (i.e., compiling with
-d:chronosHandleException
) with Chronos, but I'm running into a compilation issue (nim 1.6.20
,Linux x86_64
) . The following example:will fail with:
Looking at the offending code, I see:
where
cbproc
is of type:I suppose the intent here is to make this into a safe
DatagramCallback
:at which point this seems to be missing a call to
await
?As a side note, this code as it is now is pretty strange even when it compiles - the Future returned by
cbproc
is never set as a return value in the expansion ofwrap
(produced with-d:chronosDumpAsync
); i.e., it doesn't seem to be callingsetResult
as other procs do:I tried to figure out the implication of this by doing some testing on iterators and seeing what happens to those "fall through" values, and it looks like they're simply lost; e.g.:
so not really sure what happens to the Future returned from
cbproc
after the call (guess it just runs as if we had donediscard cbproc(...)
?).I'm opening a PR adding the calls to await as that seems to fix it, doesn't break anything, and seems to reflect the actual intent, but considering the above I'm not sure that's the only issue.