-
Notifications
You must be signed in to change notification settings - Fork 18k
proposal: spec: permit directional variants of named channel types #21953
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
Comments
Isn't this kind of like doing
i.e., I wouldn't expect this to work at all. |
I'm tentatively marking this as a language change, unless you are suggesting that the current parser is not matching the written spec (in which case this is a bug). |
I think it's a language change. |
Definitively a language change, possibly backward compatible. But why would we want to allow such a thing? It makes the direction arrow an operator on types, and only on channel types. And it only can make a bidirectional channel a read-only channel. What if I wanted to create a write-only channel? In the current design of the language I don't see why this would be worth the effort. |
This is requesting similar syntax to #22189. |
I'm not saying it is or is not worth the effort, but it definitely a flaw in the design that one can declare read-only channel types only if they are unnamed. I can't think of another property of the language that works like this, for instance that changes the possible types acceptable by a function. |
See also #23415. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as resolved.
This comment was marked as resolved.
An possible problem with this proposal might be ambiguity of the parse tree (requiring type information to resolve it). To be investigated. |
Consider this program:
All is well. Now try to declare a direction for a Foo:
This doesn't parse, but it's reasonable to expect it would and maybe, perhaps with parenthesization, easy to define without ambiguity. (A directional Foo with element type Foo could be tricky.)
Reported on twitter.
The text was updated successfully, but these errors were encountered: