Skip to content

Proposal: Readers Read(...), Writers Write(...) #25

Open

Description

@nyk

A famous Chinese proverb attributed to Kong Fu Tse is, "Fathers father, sons son", meaning that the name of "father" is given to a man who raises children (fathers them), and the name of "son" is given to a boy/man who acts with filial duty (sons: as a verb). A name or role is properly granted only to those duties or functions it can perform; functions that are expected from the one bearing the name.

This is how we treat the implementation of Go interfaces implicitly, in that if a type has a function with the "Read(p []byte) (n int, err error)" specification it means it is capable of acting like a Reader, and therefore it IS a Reader. Likewise, we call a Writer that which can write (implements the Write(...) function).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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