Why can't Encoder directly determine whether an element implements an interface (such as fmt.Stringer or encoding.TextMarshaler) and actively call its interface to implement Encode()?
After all, Decode already does that (using encoding.TextUnmrshaler interface).
Why can't Encoder directly determine whether an element implements an interface (such as
fmt.Stringerorencoding.TextMarshaler) and actively call its interface to implementEncode()?After all,
Decodealready does that (usingencoding.TextUnmrshalerinterface).