Skip to content

Two "streams" confusion #1

Open
@domenic

Description

@domenic

With this change the Encoding Standard will have two concepts of "stream": https://encoding.spec.whatwg.org/#concept-stream and a TransformStream.

I see three ways out of this:

  • Rename the Encoding Standard's concept to something like "token sequence" and update all existing uses.
  • Try to consolidate everything into the TransformStream model internally.
  • Create some underlying concept that both can share, such that TransformStream is one implementation of the concept and TextEncoder/TextDecoder are another.

I think I lean toward the "token sequence" approach. The way it is treated is pretty different from streams in general, e.g. allowing both prepending and appending, and using EOS instead of { value, done }, and using abstract single bytes and single code points instead of JS Uint8Arrays and strings (which can themselves represent many characters each). This fits with my preference expressed in whatwg/encoding#72 (comment) to have a clean break between the "token sequence APIs" (TextEncoder/TextDecoder) and the TransformStream APIs (TextEncoder.stream/TextDecoder.stream).

@annevk should probably weigh in on this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions