Closed ghost closed 1 year ago
Why?
Why?
I think task.defer
is better suited for what Promise.defer
needs to accomplish -- the point is to simply resume a Promise as soon as possible, but not immediately, so resuming in the next frame when you can resume within the next invocation point (now) doesn't seem reasonable.
Why?
Here's a few reasons:
One thing to consider:
Promise.defer
resulting from a Promise.defer
) will happen at the next entry-point but the next entry-point is already the current oneP.s. task.defer
like all of the other task methods additionally works with threads, so the following is a sufficient replacement for a :Wait()
:
task.defer(coroutine.running())
coroutine.yield()
Currently,
Promise.defer
usesRunService.Heartbeat
, which should be replaced withtask.defer
instead. The current implementation ofPromise.defer
results in the Promise being resumed in the next frame, rather than the next invocation point.