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

Remove knowledge of child StateT type from compose. #214

Closed

Conversation

zach-klippenstein
Copy link
Collaborator

Closes #213.

@zach-klippenstein zach-klippenstein added this to the v0.10.0 milestone Mar 26, 2019
@@ -38,7 +38,7 @@ import kotlin.coroutines.experimental.CoroutineContext
* [Workflow.initialState].
*/
internal class WorkflowNode<InputT : Any, StateT : Any, OutputT : Any, RenderingT : Any>(
Copy link
Contributor

Choose a reason for hiding this comment

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

If WorkflowContext.compose no longer knows about StateT, how is WorkflowNode learning about it? Where does it come from?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It basically doesn't, it's effectively Any. But it doesn't need to in practice. The generic param is basically just there so the Workflow methods all agree.

Copy link
Contributor

Choose a reason for hiding this comment

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

Let me see if I understand: the StateT of the root WorkflowNode comes from WorkflowHost.Factory#run$workflow_host. But of every other WorkflowNode in the tree has StateT of Any? Given that, can you push this PR farther and get rid of StateT from WorkflowNode and RealWorkflowContext?

@zach-klippenstein zach-klippenstein force-pushed the zachklipp/remove-compose-state-type branch from b77591f to a2b675f Compare March 27, 2019 00:13
return rendering
}
): RenderingT =
composeWithStateType(workflow as Workflow<InputT, StateT, OutputT, RenderingT>, input)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@rjrjr The cast you're looking for is here.

Copy link
Contributor

@rjrjr rjrjr left a comment

Choose a reason for hiding this comment

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

Okay with me to merge as is to lock in the gain, but if we can push this further we really should.

@zach-klippenstein zach-klippenstein force-pushed the zachklipp/remove-compose-state-type branch from a2b675f to 0945a4c Compare March 27, 2019 20:06
@zach-klippenstein
Copy link
Collaborator Author

Declining in favor of #219.

@zach-klippenstein zach-klippenstein added the kotlin Affects the Kotlin library. label Mar 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kotlin Affects the Kotlin library.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

WorkflowContext.compose shouldn't have to know child workflow's state type.
2 participants