3 ms·
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
by gpderetta 10y ago
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.
- amscanne 10y agoThat 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 https://golang.org/src/runtime/chan.go