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

Proposal: add Channel.receive_first_with_index and Channel.send_first_index #6657

Closed
joatca opened this issue Sep 3, 2018 · 1 comment
Closed

Comments

@joatca
Copy link

joatca commented Sep 3, 2018

Channel.receive_first and Channel.send_first discard the index returned by the underlying Channel.select. To handle cases where the channel that performed an operation is significant, I propose Channel.receive_first_with_index for receiving and either a new method Channel.send_first_index or returning the index directly from Channel.send_first and allowing using code to discard it. The discussion at crystal-lang/crystal-book#279 (review) suggests that Channel.select is intended as a low-level interface and that the *_first methods are considered the high-level interface.

Implementation of this should be trivial so I'm willing to submit a PR if everyone is agreeable.

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

No branches or pull requests

3 participants