Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Programming Languages as Constraints. Parent comment
Channels can be designated as receive-only or send-only in variable and function declarations:
ch := make(chan int, 1) var send chan<- int = ch var recv <-chan int = ch send <- 1 // ok <- recv // ok recv <- 1 // invalid operation: recv <- 1 (send to receive-only type <-chan int) <- send // invalid operation: <-send (receive from send-only type chan<- int)
Channels can be designated as receive-only or send-only in variable and function declarations: