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

Added private functions for resetting the global runtime #2114

Merged
merged 1 commit into from
Jul 12, 2021

Conversation

djspiewak
Copy link
Member

This is one attempt to (somewhat) address #1959. Would love some thoughts on it. I basically want to make the most narrowly-scoped thing possible. You could get at this by calling IORuntime.asInstanceOf[{ def resetGlobal(): Unit }].resetGlobal().

@vasilmkd
Copy link
Member

vasilmkd commented Jul 9, 2021

Gotta love reflective calls.

@djspiewak djspiewak added this to the 3.2.0 milestone Jul 11, 2021
@djspiewak djspiewak merged commit 5c9df79 into typelevel:series/3.x Jul 12, 2021
@cquiroz
Copy link

cquiroz commented Jul 12, 2021

Thanks I'll give it a try, cool
Trick to allow calls to a private method

@johnynek
Copy link

I'm confused how this interacts well with lazy val global? Isn't that fixed exactly once and changing _global won't change anything?

@cquiroz
Copy link

cquiroz commented Jul 26, 2021

FWIW this is working as I wanted for my use case

@djspiewak
Copy link
Member Author

I'm confused how this interacts well with lazy val global? Isn't that fixed exactly once and changing _global won't change anything?

Bleh. You're correct. It doesn't interact at all. This basically only solves the problem from the perspective of IOApp.

@johnynek
Copy link

mutation. Not even once!

;)

@djspiewak
Copy link
Member Author

mutation. Not even once!

Sir, you came to the WRONG part of town! ;-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants