[ccan] Add new 'bytestring' module

Joey Adams joeyadams3.14159 at gmail.com
Tue May 22 03:07:19 EST 2012


On Mon, May 21, 2012 at 5:02 AM, David Gibson
<david at gibson.dropbear.id.au> wrote:
> I'm not entirely sold on the bytestring name either, but I haven't
> come up with a better one.

Looks like the name was stolen from Haskell's ByteString library [1].
As a Haskell programmer, I'm happy with the name.

Haskell has built-in Strings, but has a different deficiency than C
strings (namely, use of NUL as a terminator).  In Haskell, a String is
just a list of Unicode characters.  This, of course, is extremely
inefficient--one list node per character--unless the optimizer fuses
the producer and consumer together, eliminating node allocation.
Also, Unicode characters aren't a faithful representation of binary
data, so Haskell's ByteString library provides a packed, immutable array
of octets.

ByteString [1] may be a good source of names, but it
was designed under much different constraints than a similar C library
would have.

 [1]: http://hackage.haskell.org/packages/archive/bytestring/latest/doc/html/Data-ByteString.html

-Joey


More information about the ccan mailing list