The <- operator associates with the leftmost chan possible:
chan<- chan int // same as chan<- (chan int)
chan<- <-chan int // same as chan<- (<-chan int)
<-chan <-chan int // same as <-chan (<-chan int)
chan (<-chan int)
All above 4 scenarios, I did not understand. Please help me to understand.
Thank you very much for the response.
But I have dissected the syntax and checked it in the playground on my own. I have a clear picture now.
The channel variable declaration has two parts. channel_variablechannel_type
channel_type further can be dissected as below
chan keyword, which depicts the variable as a channel.
Direction of the channel (sending and receiving). (optional)
Type of the value, a channel can hold.
A channel_type syntax can be used as a type of value a channel can hold in another channel declaration. Which is point number 3. in the above description
This is how the language specification should have been mentioned similar for the channel topic.