[erlang-questions] byte() vs. char() use in documentation

David Mercer dmercer@REDACTED
Fri May 6 15:37:41 CEST 2011


On Friday, May 06, 2011, Raimo Niskanen wrote:

> But: iolists are only about bytes, not characters. They are for being
> able to efficiently construct a byte sequence e.g to send to a driver.

Aha!  Yes, you are absolutely right.  I got caught in the mistaken idea that
iolists are, at their core, strings, with maybe some binary data sprinkled
in.  But as you so rightly point out, iolists are not about an
easy-to-construct representation of strings, they're about easy-to-construct
representation of bytes for I/O purposes (probably mainly O).

> But: there is just raw binary data in an iolist.
> 
> >
> > 	iolist() :: [char() | binary() | iolist()]
> 
> Not char(); byte()!
> 	iolist() :: [byte() | binary() | iolist()]

You are correct.  You are correct.  You are correct.

Cheers,

David




More information about the erlang-questions mailing list