-
Couldn't load subscription status.
- Fork 1.4k
Remove debug code from Ref-backed proxy class macro #8092
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
Conversation
|
@SHSongs Thanks for this! Noticed a couple of other things as I was working on using this to implement the We want to be able to use the def reload[A: Tag]: IO[ServiceReloader.Error, Unit] =
??? // uses generate internallyRight now this doesn't work because for a polymorphic type "disallowed" methods such as Perhaps we could package this evidence up into a trait, say |
|
Here's a quick sketch. Is this what you mentioned, @adamgfraser? trait ReloadableService[A] {
def tag: Tag[A]
def serviceProxy: A // macro generated proxy
def set[R, E](acquire: ZIO[R with Scope, E, A]): ZIO[R, E, Unit] // forward to underlying `ref: ScopedRef[A]`
}// Use `ReloadableService[A]` instead of `Tag[A]`
def register[A: ReloadableService](serviceLayer: ZLayer[Any, Any, A]): IO[ServiceReloader.Error, A] |
|
@guersam Yes I think so! |
|
@jdegoes I think this one is done as it is, but the issue @adamgfraser pointed out should be addressed. As the purpose #8061 was to support #8077, I'd like to ensure that the reworked macro works with Possible future actions:
@jdegoes @adamgfraser Which way do you prefer? |
|
@guersam I don't think we will be able to merge #8077 until the comment above is addressed because right now |
|
@adamgfraser Understood that option 1 is impossible. Then I'll make another PR against your fork (option 2) to discuss more design details in relation to ServiceReloader and to make sure the implementation meets the real requirement. |
|
@guersam Sounds good! |
|
Opened https://github.com/adamgfraser/zio/pull/12 for further discussion. |
Remove debug code from Ref-backed proxy class macro
#8061