[erlang-questions] string/iolist survey

Richard Carlsson richardc@REDACTED
Mon Feb 12 16:09:22 CET 2007


Christian S wrote:
> What set of values do we refer to when talking about the type string()?
> 
> I see iolist() used frequently as to be explicit that one mean the
> nested-lists-and-binaries.
> 
> In docs for module io_lib the type chars() is introduced and defined as:
> chars() = [char() | chars()]. To exclude binaries.

Taking a quick look at the code, it seems that the docs need to be
updated, but I'm not sure if all the functions accept IO-lists.

> string() = [char()] ?

Yes. string() should mean a flat, proper list of chars (integers),
and nothing else. If some text just uses the word "string", i.e.,
not written using the type notation with parentheses, it is best
to take a closer look, and not make too many assumptions.

     /Richard




More information about the erlang-questions mailing list