-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Scheduler name bike-shedding #838
Comments
I see no objections to this... |
In talking to @chriscareycode, @abersnaze and @stealthcode at Netflix, there were a few other options presented for names around
... all parties thought that |
Trampoline sounds the best IMO. |
+1 for |
I'd be interested in thoughts from @zenparsing, @domenic, @wycats or @stefanpenner on this, as well. I'm sure this sort of scheduling has come up in conversations at the TC39, and they might have more specific vernacular we could leverage. |
@Blesh that's been the problems with transporting the names from runtime to runtime. CurrentThread has a history of doing recursive scheduling right, placing things in the right order whereas the immediate was indeed immediate. Consider the difference: const Scheduler = require('rx').Scheduler;
Scheduler.currentThread.schedule('bye', (self1, state1) => {
self1.schedule('hi', (self2, state2) => console.log(state2));
console.log(state1);
});
// => bye
// => hi Whereas the immediate scheduler would do the following: const Scheduler = require('rx').Scheduler;
Scheduler.immediate.schedule('bye', (self1, state1) => {
self1.schedule('hi', (self2, state2) => console.log(state2));
console.log(state1);
});
// => hi
// => bye |
@Blesh had I done it over again, I would have the following:
Trampoline is not a word I'd like to put into my API as it's an implementation detail that they don't really need to know nor care about. |
I completely get it. For RxJS 5, we've had the lack of a scheduler mean "immediate" as in "no scheduling at all, just call it".
I sort of like |
@Blesh and for the most part, RxJS v4 has done the same with |
From my point of view the only kind of scheduling that makes sense is "job queuing" (called microtask queue elsewhere). : \ |
Therefore I don't see the point in all of these different (and confusing) names. |
Suppose you want to synchronously traverse a tree recursively and the tree is 1000 levels deep. ... that's why there is more than one scheduler. :) |
@zenparsng where you are coming from and where we are, are two different spots. There is the want, especially on the ES-Observable, to make everything async, hence the microtask. Here, we want the swappable concurrency layer to choose which is right for us, like |
@trxcllnt ... well PR that thing! 😝 |
@Blesh still needs tests ;-) |
Okay, I think where this has landed is:
Is this acceptable? @mattpodwysocki @kwonoj @staltz @trxcllnt? |
... the ideal being no name change, or no conflicting names ( |
@Blesh I like these names |
Some clarification on Every other scheduler is * virtual scheduling can be synchronous, but it's manual and we're not talking about that one. |
Those names looks good to me. |
I just don't like I get the point that Perhaps |
In the ES spec world, we call these things "jobs" and we have a "job queue". |
|
Talking with @jhusain, he brought up a valid point, that by strict definition of "synchronous", the trampoline scheduler is not "sync" because it schedules on the next call stack. Being in the same event in the event loop doesn't really mean "synchronous" in the strictest sense of the word. For example, if you're inside of an action scheduled on the trampoline scheduler, and it's currently running, and you schedule from within that action, it's going to complete your current action before it runs the one you just scheduled. That's not synchronous. Interestingly, it sheds more light on the name Also, @jhusain reiterated what @zenparsing said above, which is in the ES community the "microtask" queue is generally called a "job", but he also liked the name "trampoline". So now a new proposal:
|
Right now I'm inclined to say @stealthcode brought up the point that we might add |
How about:
|
@Blesh I'm lukewarm on the I'm inclined to name schedulers after the method in which they schedule:
|
I liked |
Still ambiguous: both timeout and eventLoop indeed schedule on the event loop. |
HAHA... soft reason that "job" is out: Try googling ECMAScript Job or JavaScript Job. Yeah... no. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Currently the trampoline scheduler is named
immediate
, and the microtask scheduler is namednextTick
. There is alsI propose that we rename
immediate
tosync
. I say this becauseimmediate
sort of implies that the scheduled action is going to take place right away, and that's not really true. It's going to be bumped from it's current call stack and executed next, but synchronously.For
nextTick
, it's a little more debatable, it's pretty aptly named, but I think it would be more descriptive if it were namedmicrotask
, because ultimately that's the goal. To schedule it as a microtask after the current frame but before things likesetTimeout
.... which brings me to another thing, we don't have a scheduler based off of
setTimeout
orrequestAnimationFrame
. The latter is DOM-specific, but given that we're modular now, I think there's grounds for including it in this library, it's an important scheduler.Once we land on these names, I'll be writing some improved documentation on the matter.
The text was updated successfully, but these errors were encountered: