You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think the choice of Write as the method name for writing to an io.Writer in wire format is poor. Write is a well known method name coming from the io.Writer interface, so it can be confused with it.
But worse than that, while Write([]byte) error modifies the receiver, Write(io.Writer) error modifies the argument.
I understand that the signatures are different, but if I'm quickly reading code I want to be able to understand what's going on without keeping track of types and signtures. Right now, if I see this line, it's very hard to know which of the two it is without reading more code and some light investigation:
r.Write(buf)
I think a better name would be WriteTo or WriteToWire. Suggestions welcome.
This can't be done in Go 1.x, so marking as Go2.
The text was updated successfully, but these errors were encountered:
I think the choice of
Write
as the method name for writing to anio.Writer
in wire format is poor.Write
is a well known method name coming from theio.Writer
interface, so it can be confused with it.But worse than that, while
Write([]byte) error
modifies the receiver,Write(io.Writer) error
modifies the argument.I understand that the signatures are different, but if I'm quickly reading code I want to be able to understand what's going on without keeping track of types and signtures. Right now, if I see this line, it's very hard to know which of the two it is without reading more code and some light investigation:
I think a better name would be
WriteTo
orWriteToWire
. Suggestions welcome.This can't be done in Go 1.x, so marking as Go2.
The text was updated successfully, but these errors were encountered: