Writer? Encoder? Putter?

I am creating a library for writing certain data objects (hence MyStruct) 
to an io.Writer. I was trying to find how Go's standard library typically 
names interfaces like that so that I could stick to the conventional naming.
Seems that the JSON <https://golang.org/pkg/encoding/json/#Encoder> package 
uses Encoder and Encode. The CSV 
<https://golang.org/pkg/encoding/csv/#Writer> package uses Writer and 
Write. I see that the Encode naming is more common in the encoding/... 
packages, but these usually encode general values (interface{}) and not 
specific types (like MyStruct).

What would be an idiomatic naming/API design for a case like this?
What makes CSV a writer and JSON an encoder?

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/0467f446-28a3-486a-ac38-fd4dcbd5e1fbn%40googlegroups.com.

Reply via email to