Skip to content
This repository was archived by the owner on Jun 4, 2019. It is now read-only.
This repository was archived by the owner on Jun 4, 2019. It is now read-only.

Unusual Encoder/Decoder signatures? #4

@dmitshur

Description

@dmitshur

Please correct me if I'm wrong. I don't think there's a standard interface for Encoder/Decoder types, but as far as I can see, they all typically take an io.Reader to create a Decoder, and io.Writer to create an Encoder.

For example, look at:

http://godoc.org/encoding/json#NewDecoder
http://godoc.org/encoding/xml#NewDecoder
http://godoc.org/encoding/ascii85#NewDecoder

Then, their Encode/Decode methods take one parameter and return just error.

The Encoder/Decoder in this package do not take a writer/reader, but instead return the encoded/decoded data alongside the error.

My question is, would it be a better API if they did take a Reader/Writer?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions