Binary API Design Questions

Kris Kowal kris.kowal at
Tue Dec 1 15:45:28 PST 2009

[+es-discuss, w3c, commonjs]

I have posted a new draft proposal.

Discussion so far has illuminated the dimensions for the general
approach to such an API.

1. Whether to support both mutable and immutable binary data types.
2. Whether to mutables should be modeled after Array and immutables after String
3. Whether to support bit quantized types or methods
4. Whether to support charset encoding/decoding with methods
5. Whether to support radix encoding/decoding with methods
6. Whether to support struct packing/unpacking/calcsizing with methods
7. Whether to explicitly or implicitly manage contiguous memory ownership
8. Whether to target native support: short term, long term, never
(This affects whether to require [[Get]], [[Put]], ==, and ===
operators to be revised to handle bytes alongside character strings,
or whether to establish a precedent for methods like "equals")

The biggest collective question is whether, and in what time-frame,
binary data would be supported as a primordial or primordials
analogous to String and Array.  CommonJS is naturally anxious to
produce a specification that can be stubbed in the short term.  For
the CommonJS group, the bit question then is future-compatibiilty.
Should we strive to effect usage patterns that would be conducive of
an eventual native implementation?  For example, should "new
ByteString" be required to return a boxed type?  Should it throw an
exception in the short term so that people won't write code that
expects an un-boxed object to be constructed?  Can we expect that
typeof ByteString() will be "object" in a future ECMA or W3C

Kris Kowal

More information about the es-discuss mailing list