4 ms·
Forgive me if I'm wrong, but I believe this is because the select keyword is a language syntax convenience whereas actual I/O needs a full go routine because th
by haimez 10y ago
Forgive me if I'm wrong, but I believe this is because the select keyword is a language syntax convenience whereas actual I/O needs a full go routine because that's the unit of parallelism.
- eternalban 10y agoUnlike C, Go has a runtime component. Select is not merely syntactical sugar: https://golang.org/src/runtime/select.go#L114 https://golang.org/src/runtime/select.go#L114
- pjmlp 10y agoC has a runtime, it is usually called libc and libm on UNIX C compilers, msvcrt.dll on Visual C++, so forth for each C compiler. Also some would say POSIX is the language runtime that ANSI didn't want to approve.
- eternalban 10y agoI've always considered a "language runtime" to be an active component of a process written in a given language. Aren't libc etc. passive and effectively just libraries?
- pjmlp 10y agoNo, depending on the compiler it is where the call that calls main() and calls global initialization lives, also where support functions for compiler intrisics might live, also the implementation support for data types not directly supported by the architecture, e.g. floating point emulation.
- eternalban 10y agoInteresting, thanks. In the future I'll be sure to use [the term] active runtime (GC, scheduler).
- fnord123 10y agoCompiled and linked C code can run without libc.
- haimez 10y agoRight... which means that "select" is like "class". It means some shit, but it isn't supposed to mean "KERNEL ASYCIO INTERFACE" the same way that "class" doesn't mean struct.