Add unsafeRunSync* syntax for JS Dispatcher - #2846
Merged
djspiewak merged 3 commits intoMar 17, 2022
Merged
Conversation
Member
|
Btw haven't forgotten about this. I'm thinking we might be able to make it a bit more convenient in some cases. Will see if I can find time to experiment a bit. |
djspiewak
approved these changes
Mar 17, 2022
djspiewak
left a comment
Member
There was a problem hiding this comment.
Did some experimentation. I think this is about the best we can do for now. We could remove the syncLimit parameter for any F: LiftIO, but that would actually be really weird because then you would have code that would compile until you add a constraint, at which point scalac would start telling you that you're missing a parameter. So that seems worse than just having it behave this way all the time.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
IOin #2613 forDispatcher(JS-only).It needs to be added as syntax in core due to the dependency on
SyncIOfor theunsafeRunSyncexecution.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
Deferredoroffering 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
limitparameter, which we can't fish out of theIORuntimein this case. So it will almost definitely be hardcoded, which requires some iota of thinking or tempts a lazyInt.MaxValuewhich is probably fine for thecomplete/offeruse-cases.