10000 [core] move fromCompletionStage from Fiber to Async by fwbrasil · Pull Request #1195 · getkyo/kyo · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[core] move fromCompletionStage from Fiber to Async #1195

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

fwbrasil
Copy link
Collaborator

Problem

Fiber is a low-level effect with complex semantics for newcomers. Its functionality is essential for integrations and more low-level code but Async provides better usability and covers a majority of use cases. For this reason, Fiber's API has become more limited over time and we don't even provide common combinators like race for it since the same functionality can be achieved via Async combinators and Async.run to obtain a Fiber. I hadn't noticed that fromCompletionStage is still in Fiber and using an old method naming pattern with a Fiber suffix.

Solution

Move the method to Async and remove fromCompletionStageFiber.

@@ -3,17 +3,14 @@ package kyo.internal
import java.util.concurrent.CompletionStage
import kyo.*

trait FiberPlatformSpecific:
trait AsyncPlatformSpecific:
def fromCompletionStage[A](cs: CompletionStage[A])(using Frame): A < Async =
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can alias this to fromFuture as well. It should typecheck as an overload (to Scala's future).

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.

2 participants
0