Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Added bracketWeak, bracketCaseWeak, and onFinalizeWeak to allow scope-less resource management #1593

Merged
merged 3 commits into from
Sep 8, 2019

Conversation

mpilquist
Copy link
Member

@mpilquist mpilquist commented Sep 7, 2019

These three combinators behave like bracket, bracketCase, and onFinalize did in 1.0.5. One nice property of having these three operations is that we won't run in to a situation where someone was relying on the 1.0.5 behavior and there's no way to get it back in 1.1.0.

@mpilquist mpilquist requested a review from SystemFw September 7, 2019 19:21
Copy link
Member

@ChristopherDavenport ChristopherDavenport left a comment

Choose a reason for hiding this comment

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

👍 Yay!

@mpilquist
Copy link
Member Author

Oh one note about this -- maybe since this allows registration to the current scope, we should make Stream#scope public again to allow manual scope creation.

@mpilquist
Copy link
Member Author

I restored Stream#scope and added scope-less bracket/bracketCase. I did NOT add equivalent scope-less methods for the cancelable variants of bracket as I'll be removing them in the next PR, along with the Pull.acquireCancellable stuff.

@mpilquist mpilquist changed the title Added onFinalizeWeak to allow registration of finalizers without scope introduction Added bracketWeak, bracketCaseWeak, and onFinalizeWeak to allow scope-less resource management Sep 8, 2019
Copy link
Collaborator

@SystemFw SystemFw left a comment

Choose a reason for hiding this comment

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

Looks good to me. I think another advantage is that is easier to see which operations actually introduce a Scope given that bracket has a direct call to scope now.

Maybe some small bit of scaladoc could be added to onFinalizeWeak to show the only use case I know of it so far, namely things like

a.concurrently(b).onFinalizeWeak(something).compile.resource.lastOrError

@mpilquist mpilquist merged commit dd26385 into typelevel:series/1.1 Sep 8, 2019
@mpilquist mpilquist added this to the 1.1.0 milestone Sep 10, 2019
@mpilquist mpilquist deleted the topic/onFinalizeWeak branch February 18, 2020 12:56
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants