Add unsafeRunSync*
syntax for JS Dispatcher
#2846
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Following up on #2835 (comment), replays the convenience methods added to
IO
in #2613 forDispatcher
(JS-only).It needs to be added as syntax in core due to the dependency on
SyncIO
for theunsafeRunSync
execution.Daniel proposed an alternative in #2835 (comment):
IIUC it's proposing something like this on
Dispatcher
:which I would then call like this:
But at that point, I think I could just as easily write:
This assumes I don't care about the result ... which in many cases I don't, because I'm completing a
Deferred
oroffer
ing to aQueue
.The syntax proposed here gets us this:
dispatcher.unsafeRunSyncToFuture(fa, 32)
So, subjective obviously. And not necessarily mutually exclusive.
I also wish there was a better story for the
limit
parameter, which we can't fish out of theIORuntime
in this case. So it will almost definitely be hardcoded, which requires some iota of thinking or tempts a lazyInt.MaxValue
which is probably fine for thecomplete
/offer
use-cases.