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

=str Switch the type parameter order of UnfoldResourceSource. #615

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

He-Pin
Copy link
Member

@He-Pin He-Pin commented Sep 2, 2023

Motivotion:

The type paramaeter S is really not great and the order is wrong

NOTE:
The user facing api is untouched, as that will break code.

Result:
Clean code.

Expects a mima error?

@pjfanning
Copy link
Contributor

I'm going to take some convincing that Pekko should go this way. Like it or not, most Pekko users are former or current Akka users. I don't see why making small adjustments to functions like this really helps. I favour keeping APIs including the type params as close as possible to Akka. New features would be absolutely great. Improving the internals of functions in a way that doesn't affect the API is great.

@He-Pin
Copy link
Member Author

He-Pin commented Sep 2, 2023

The userfacing api did not change the type parameter order, and this is safe to compile both in source and binary, only be a problem when you use a reflection api to retrieve the typevariable's value.

* @tparam T - the element type
* @tparam R - the resource type
*/
def unfoldResource[T, R](
Copy link
Member Author

Choose a reason for hiding this comment

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

@pjfanning Do you mean keep the typeparameter S here?

@pjfanning
Copy link
Contributor

The userfacing api did not change the type parameter order, and this is safe to compile both in source and binary, only be a problem when you use a reflection api to retrieve the typevariable's value.

Even if the code compiles and bin compatibility is unaffected - there is the problem with the documentation and why our type params have different names from the Akka ones. In the end. how is R better than S. They are both unhelpful.

Keeping the type param names as is and adding typeparam documentation would be more useful, in my opinion.

@He-Pin
Copy link
Member Author

He-Pin commented Sep 2, 2023

@pjfanning https://doc.akka.io/api/akka/2.8/akka/stream/scaladsl/Flow.html#mapWithResource[R,T](create:()=>R)(f:(R,Out)=>T,close:R=>Option[T]):FlowOps.this.Repr[T]

In this later, pr , R is used, that's why I want a Resource relative api here to be R not S. and in fs2, def bracket[F[_], R](acquire: F[R])(release: R => F[Unit]): Stream[F, R] = ...

resumingMode = true
}
override def preStart(): Unit = {
resource = create()
Copy link
Member Author

Choose a reason for hiding this comment

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

It was named blockingStream, which leads to some kind of confusing.

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.

None yet

2 participants