Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asyncdispatch.sleepAsync broken #614

Open
juancarlospaco opened this issue Feb 22, 2021 · 2 comments
Open

asyncdispatch.sleepAsync broken #614

juancarlospaco opened this issue Feb 22, 2021 · 2 comments
Labels
bug Something isn't working easy float

Comments

@juancarlospaco
Copy link
Collaborator

sleepAsync takes float (???), it should have same proc signature than sleep and use Natural argument only.

import asyncdispatch, times

proc main(a: float or int) {.async.} =
  let t = now()
  echo "BEFORE\T", t, '\T', a
  await sleepAsync(a)
  echo "AFTER\T", t - now(), '\n'

waitFor main(1)  # Control
waitFor main(0.0)
waitFor main(-0.0)
waitFor main(1.0)
waitFor main(-1.0)
waitFor main(-1.0)
waitFor main(NaN)
waitFor main(+Inf)
waitFor main(-Inf)
waitFor main(Inf)
@juancarlospaco juancarlospaco added bug Something isn't working float easy labels Feb 22, 2021
@ringabout
Copy link
Collaborator

see #617

for a better solution

@ringabout ringabout reopened this Apr 25, 2021
@juancarlospaco
Copy link
Collaborator Author

I agree, but still this needs to be Deprecated, or remove the float overload, or something...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working easy float
Projects
None yet
Development

No branches or pull requests

2 participants