Skip to content
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

Add Future.resolved / rejected / completed as shortcuts for Future.now #45

Merged
merged 1 commit into from
Mar 10, 2024

Conversation

natsukagami
Copy link
Contributor

Might also be thinking about naming here:

  • We can have Future.resolved(T), Future.rejected(Exception) and Future.completed == Future.now to be consistent with Future.withResolver
  • We can have Future.success(T) and Future.failure(Exception) to be fully similar to Future.now(Success(T)) and Future.now(Failure(Exception)).

@He-Pin
Copy link
Contributor

He-Pin commented Mar 1, 2024

Cool, But I have a question,it will cause some inconvenient when user use gear's Future and the current Future in Scala's stdlib? What's the plan for this?

@natsukagami
Copy link
Contributor Author

Cool, But I have a question,it will cause some inconvenient when user use gear's Future and the current Future in Scala's stdlib? What's the plan for this?

@He-Pin You can probably easily convert a Scala stdlib Future into a gears Future. Going the other way shouldn't be too difficult but I will have to look into it.

@m8nmueller
Copy link
Contributor

I have a slight personal preference for resolved/rejected because the participle indicates grammatically that an action from the lifecycle of a Future (to complete) is already taken. Either way, it's a nice thing to have.

... for Future.now with Success / Failure and an alias of Future.now (to line up with the Resolver API).
@natsukagami natsukagami changed the title Add Future.success as shortcut for Future.now(Success( )) Add Future.resolved / rejected / completed as shortcuts for Future.now Mar 5, 2024
@natsukagami natsukagami marked this pull request as ready for review March 5, 2024 16:32
@natsukagami natsukagami merged commit aad1146 into lampepfl:main Mar 10, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants