-
Notifications
You must be signed in to change notification settings - Fork 47
[chore]: refactor some internal actions to use existential any #190
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
|
||
/// 'Opens' the existential `any WorkflowAction<WorkflowType>` value | ||
/// allowing the underlying conformance to be applied to the Workflow's State | ||
func openAndApply<A: WorkflowAction>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's not entirely clear to me why this is necessary, or exactly why it works, but if you try to invoke action.apply(...)
on the any WorkflowAction
variable, you get a compiler error. this makes some amount of sense b/c an any WorkflowAction
isn't itself a WorkflowAction
. i did skim this and this to see if there are other options, but this was the only thing i've been able to get working thus far.
@@ -272,7 +272,7 @@ extension WorkflowNode.SubtreeManager { | |||
|
|||
fileprivate final class ReusableSink<Action: WorkflowAction>: AnyReusableSink where Action.WorkflowType == WorkflowType { | |||
func handle(action: Action) { | |||
let output = Output.update(AnyWorkflowAction(action), source: .external) | |||
let output = Output.update(action, source: .external) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this change will help the observation API be more useful as we will be able to expose the underlying conformance and not an AnyWorkflow wrapper
…rvers * origin/main: [chore]: refactor some internal actions to use existential any (#190)
…ow-workflow-conformance * origin/main: Expose AnyScreen.wrappedScreen for inspection (#193) Improve introspection for SignalProducerWorkflow actions (#192) [release]: bump version to 2.2.0 & remove separate concurrency version (#191) [feat]: add runtime observation API (#168) [chore]: refactor some internal actions to use existential any (#190) [fix]: use weak reference to internal sinks when vending to clients (#189) [feat]: add primary associated types to more protocols (#188) [chore]: pre major version bump cleanup (#187) [chore]: bump minimum deployment & swift versions (#186) Abstract ViewEnvironment to shared framework (#185)
Description
since we now have access to primary associated types, there are a couple places internally where it likely makes sense to leverage the language's 'existential' boxing facilities over our own. to start, we'll update a couple places that pass an
AnyWorkflowAction<T>
that can now be replaced withany WorkflowAction<T>
.additional comments inline.
Checklist