Skip to content

Fix workflow operators#72

Merged
zach-klippenstein merged 3 commits intomasterfrom
zachklipp/fix-operators
Dec 10, 2018
Merged

Fix workflow operators#72
zach-klippenstein merged 3 commits intomasterfrom
zachklipp/fix-operators

Conversation

@zach-klippenstein
Copy link
Collaborator

@zach-klippenstein zach-klippenstein added this to the v0.5.0 milestone Dec 9, 2018
import kotlin.coroutines.experimental.CoroutineContext

/**
* [CoroutineContext] used by [Workflow] operators below.
Copy link
Contributor

Choose a reason for hiding this comment

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

Could explain why you chose Unconfined. (Follow up for nits is fine w/me.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

#74

upstreamChannel.consume {
whileSelect {
upstreamChannel.onReceiveOrNull { upstreamState ->
if (upstreamState == null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if both of these would be more readable flipped and converted to use ?.let / ?:.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

That feels like code golf to me. let improves readability when the nullable value is being transformed, in this case it's not, it's being used as a sentinel for a completely different signal (channel close). This isn't ideal obviously and there's an open issue to make a more explicit receive call that doesn't use null.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants