-
Notifications
You must be signed in to change notification settings - Fork 359
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
Move and/or rename Process.sleep
?
#692
Comments
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. |
In your opinion, or the opinion of the mailing list person, what does |
@nikoudel, you are probably in a better position to answer the above question. |
Considering |
As an Elm newcomer arriving from .NET world I was familiar with tasks so I was looking for something like Task.Delay. It was surprising to find Process.sleep in Elm because (coming also from Javascript world) I knew it's impossible to actually "sleep" (i.e. block a thread) in a browser. Process.sleep returns a task immediately, it doesn't really block a thread so it's not sleeping in a traditional meaning. The word "sleep" in programming is quite a strong concept. It's a big red hammer, a real boogeyman to be afraid of because normally you're on the main thread and sleep stops the world for a while. |
@OvermindDL1, but what is that "process" that is sent to sleep? If the user hasn't created any new process with @nikoudel, about this part:
That's actually the situation for all But even so, from all the above I now also think that Given the .NET link provided by @nikoudel, Maybe as a last question to @nikoudel: You originally indicated you sought this functionality in |
Time module was the first place I searched for the function mainly because the guide mentions Time.every which is close in terms of behavior. But right after that I clicked Task which is right before Time in package list. So, yes, I would definitely have found it if it was there. |
@jvoigtlaender Actually the main 'elm process' is 34 different processes in my current application. An |
@OvermindDL1, I was talking about the impression that an Elm user (who has not consciously
reflected in the documentation that an aspiring Elm user encounters? Maybe you didn't notice that my question
was rhetorical. I do know (what you try to explain to me now) that it's not the whole app, but instead some task in its own mini-process. But that I know that is not the point. The point is whether one gets that knowledge from the documentation, and if not, what one may incorrectly think the "current process, when one hasn't |
It could use a documentation fix, but consider that Elm does not have generic types, and since 'sleep' is operating on the Process it also seems like it should belong in Process. You could also make other sleeps that work on other types, but the Process type sleeping makes sense to have sleep on it? That might make for better documentation (make it more generic of course ^.^). |
@OvermindDL1, what is the " spawn : Task x a -> Task y ProcessId
kill : ProcessId -> Task x ()
sleep : Time -> Task x () In what sense does |
Eh, I mean the back-end Process type, the javascript calls it Process so it might be a javascript-only type that is not implemented in Elm (I've looked more at the javascript back-end of elm... >.>). |
So, in other words, your argument seems not to be relevant when considering the "aspiring Elm user" I was talking about above. The one who tries to get stuff done in Elm. |
I had no issue finding Process.sleep and I use Elm at work for work with almost 4000 LOC so far? So it fit my view as-it-is? |
But that's a different argument now. You found the function in From these two observations alone we cannot determine which is the "right" place for the function. |
Why not both? Time.sleep could just call Process.sleep, or vice-versa. Duplication sucks, but delegation is not bad... |
Also, sorry @evancz that this is going on as a discussion on GitHub now. Probably should have happened on the mailing list. The thing was that what I saw on the mailing list was:
I still had that mailing thread open, but did not have anything myself to say there. Then saw the other day that a renaming suggestion (for Had I known it would lead to a long discussion, I would have written on the mailing list. But at that point, the only thing I could have written on the mailing list would have been to ask: "Why is this being ignored?" |
Ah yes, I apologize as well, I'm so used to using github issues as conversation over the past ~6 years as a standard, I keep forgetting that Elm is different. I can delete all my posts if wished. |
Process when an issue gets too long is:
In this cases maybe that is "add Let's see how it goes! |
In a thread on the mailing list a user wanted this functionality but could not find it in
core
. After being pointed to it, two concerns were raised:Process
module (would have expected it inTime
).sleep
does not feel right to them, given whatsleep
functions traditionally do (in other languages).A concrete suggestion was
Time.after
instead ofProcess.sleep
.Maybe reasonable to add to meta issue https://github.com/elm-lang/core/issues/322?
The text was updated successfully, but these errors were encountered: