proposal: Go 2: allow conversion of defined types of directional channels #37691
Labels
FrozenDueToAge
LanguageChange
Proposal
v2
A language change or incompatible library change
WaitingForInfo
Issue is not actionable because of missing required information, which needs to be provided.
Milestone
Consider the following program:
As demonstrated, it is not allowed to convert a defined bidirectional channel type to a defined unidirectional channel type. This is caused by the following condition in the Go spec:
However, it is allowed to first convert to a non-defined type, then to the defined type. If I can convert a defined type V to an intermediate non-defined type, then to a defined type T, then I should be able to convert directly from V to T.
To clarify, the proposal is not to change assignability, but to add a conversion case that allows the conversion of a defined bidirectional channel type to a defined unidirectional channel type, where the element types are identical.
The text was updated successfully, but these errors were encountered: