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

Add flatten to Source[T] #198

Merged
merged 7 commits into from
Sep 4, 2024
Merged

Add flatten to Source[T] #198

merged 7 commits into from
Sep 4, 2024

Conversation

nimatrueway
Copy link
Contributor

To address #197

forkPropagate(c2) {
var pool = List[Source[T] | Source[U]](this)
repeatWhile {
selectOrClosed(pool) match {
Copy link
Contributor Author

@nimatrueway nimatrueway Aug 20, 2024

Choose a reason for hiding this comment

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

The fact that we can not know the result of select stems from which select statement is limiting. In Golang there's a hacky way to do it.
https://stackoverflow.com/a/19992525/1556045

I think both (v: V) or (c: ChannelClosed) results if they hint that which select/source they stem from would make the API more robust.

Update: created a ticket for it as Adam suggested #201

@adamw
Copy link
Member

adamw commented Sep 2, 2024

Thanks for the PR - the only reason such a method didn't exist before is because nobody wrote it :). There are some test failures, though.

As for adding a select variant which would also return the clause which was completed - maybe you can create a separate issue for that?

@nimatrueway nimatrueway marked this pull request as ready for review September 2, 2024 14:45
@nimatrueway nimatrueway changed the title Add flatten extension method for Source[Source[T]] Add flatten to Source[T] Sep 2, 2024
@nimatrueway
Copy link
Contributor Author

Thanks for the PR - the only reason such a method didn't exist before is because nobody wrote it :). There are some test failures, though.

As for adding a select variant which would also return the clause which was completed - maybe you can create a separate issue for that?

Thanks for taking a look @adamw, I created a new ticket and made the test pass. Let me know if there's any concern with the readability of the tests or more test cases would help.

@adamw adamw merged commit ef03467 into softwaremill:master Sep 4, 2024
5 checks passed
@adamw
Copy link
Member

adamw commented Sep 4, 2024

The test are great, thanks! :)

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