+1
I’d love to hear more about the motivation behind the io.EOF as an error. And why select a strategy to prefer no discriminated unions for the error results? Why transport non-error information in error values (io.EOF, 'http.ErrServerClosed)?
“Normal” vs. “error” [control flow] is a fundamental semantic distinction, and probably the most important distinction in any programming language - Herb Shutter
The io.Reader has caused many problems during its existence. Even so, the os packages official documentation and the File.Read example starts with a potential bug and incorrect io.Reader usage. Should the if clause be:
if err != nil && err != io.EOF { ...The issue #21852 gives an excellent overall picture of how deep unintuitive io.EOF usage can affect Go’s code and test base. It includes an interesting comment that maybe Go 2 will fix the io.Reader. Now it’s official that there will never be Go 2, maybe io.Reader2?
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/3f26b58e-b451-4fdd-b0b8-17638a30ce4en%40googlegroups.com.
When sending Read() via an RPC call or traversing locks, it is significantly faster to return EOF in the same call as returning the rest of the available data, than to call Read a second time to get the EOF.