Re:Goroutines, Nonblocking I/O, and Memory Usage
by gpderetta on Thursday January 05, 2017 @10:03PM
(#13333576)
On the contrary, the magic is required because things like select and channels and coroutines are implented at the language level in go. If they were a library with proper extension points and, sure possibly languge sugar on top, it would be doable.
[ Parent
| on HN ]
Re:Goroutines, Nonblocking I/O, and Memory Usage
by amscanne on Friday January 06, 2017 @01:27AM
(#13334388)
That is very nearly what they are.
The compiler actually just transforms everything channel related into function calls within the runtime package. The majority (probably > 99%) of the implementation of channels and select is Go itself.
E.g., see: https://golang.org/src/runtime/chan.go