News for hackers. Stuff that matters.
Re:Programming Languages as Constraints by mw42 on Friday June 03, 2016 @05:17PM (#11833338)
> It'll be interesting to see if source/sink channel types ever get retrofitted to Go in a decade or so.

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)
Re:Programming Languages as Constraints by akkartik on Friday June 03, 2016 @05:21PM (#11833360)
Ah! Can't believe I missed that..