-
Notifications
You must be signed in to change notification settings - Fork 17.7k
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: constraints: add ReadOnlyChan and WriteOnlyChan #48366
Comments
Should these be
instead? That way |
Is there a reason why the |
@smasher164 Thanks, fixed. |
Isn't a |
@andig Yes, you can. By assigning it to |
@andig Ah, I think I understand what you mean. You can't restrict it so that only a But, it's still useful for a function to declare that it will only do read or write operations on a channel - both as a signal to the caller and to get compiler-checks that the function doesn't do it. That's what's meant here. |
Absolutely. I was trying to point out that |
As an example: In this code, I'm not 100% convinced that we need that. For example, AFAIK there currently is no way for a function to declare that it takes a read-only version of TBQH, I'd probably rather do away with |
I'm withdrawing this proposal in favor of #48424. |
The currently accepted proposal for the constraints package (#45458) adds a constraint
Chan
. In #47319 (comment) @Merovius points out that does not support read-only and write-only channel types. This proposal is to add new constraintsThe text was updated successfully, but these errors were encountered: