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
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).
The text was updated successfully, but these errors were encountered:
I can look at this again, but from my understanding, go doesn't have a specific way to check if a type implements an interface. We'd have to do reflection and see if a method with a particular name existed. I'm not sure what the benefit of doing this would actually be.
Why can't Encoder directly determine whether an element implements an interface (such as
fmt.Stringer
orencoding.TextMarshaler
) and actively call its interface to implementEncode()
?After all,
Decode
already does that (usingencoding.TextUnmrshaler
interface).The text was updated successfully, but these errors were encountered: