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

Relocate or redirect `sleep` function? #693

Closed
jvoigtlaender opened this Issue Aug 18, 2016 · 2 comments

Comments

Projects
None yet
3 participants
@jvoigtlaender
Contributor

jvoigtlaender commented Aug 18, 2016

Currently it exists as

Process.sleep : Time -> Task x ()

It's not obvious to find there:

Other considerations:

  • In the .NET world, this functionality is known as Task.Delay.
  • The rest of the Process module is about processes created with, or possessing, a ProcessId, but sleep does not take one of those.
  • The documentation of the function says that "progress on the current process" is blocked. It's not very clear what that "current process" is if the user has not spawned their own process. What would probably be clearer would be to say that the "process the task returned by that function is running in" is blocked. Which amounts to saying that "the task returned by this function" sleeps for a while. No need to bring "process" into the picture. That's an argument for this being a better fit for the Task module.
  • Nowhere in the current documentation is it said that when a Task is performed it becomes a little process. Specifically, neither the documentation page for Task, nor the guide's page on tasks linked from there contain the word "process" even once. So how could a user who wants to add a delay in a task chain ever guess that the Process module is relevant (i.e., that they may find the sought functionality there)?

My proposal is to move this function to the Task module:

Task.sleep : Time -> Task x ()

Secondary proposals could be to not relocate it, but use redirections instead:

  • defining Task.sleep = Process.sleep
  • and/or Time.sleep = Process.sleep

But I don't think having the function live in different modules is necessary. Why would a user who knows they are looking for a function of type Time -> Task x () be able to find it in module Time and/or in module Process, but not in module Task? The functionality is clearly "time"- and "task"-related, but not so obviously "process"-related.

@process-bot

This comment has been minimized.

Show comment
Hide comment
@process-bot

process-bot Aug 18, 2016

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

process-bot commented Aug 18, 2016

Thanks for the issue! Make sure it satisfies this checklist. My human colleagues will appreciate it!

Here is what to expect next, and if anyone wants to comment, keep these things in mind.

@evancz evancz referenced this issue Sep 22, 2016

Open

API Ideas #322

@evancz

This comment has been minimized.

Show comment
Hide comment
@evancz

evancz Sep 22, 2016

Member

Added to #322

Member

evancz commented Sep 22, 2016

Added to #322

@evancz evancz closed this Sep 22, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment