[erlang-questions] What is the correct representation of text in erlang programs?
Tue Apr 14 18:11:12 CEST 2009
I think you are really looking at two different problems here:
1. How to represent external, for example JSON, data in a suitable way, more
specifically how to be able to see the difference between sequences and
strings both represented by lists.
2. What is a good representation of "strings" in Erlang.
They are different problems. I personally feel that within an app you
generally know what types of data you are working on, if a list is a string
or a, well, list. If not you should probably think over how your app is
The problem of representing external data in a suitable way should, of
course, be handled by the boundary layer, and once past that there should be
This is not saying that strings as lists of integers is the best way of
representing them, but rather that not properly disambiguating strings and
lists in the boundary layer is not a reason not to represent strings as
Maybe there should be a character type, but think of the problems involved
in introducing it. Not for the implementors my you, but for most existing
apps. At least when using lists you don't have to worry about the internal
representation as you would always have to do when using binaries, or
another C-string like equivalent.
2009/4/13 Steve Davis <>
> On Apr 13, 4:39 pm, Steve Davis <>
> > So would it be fair to say that, as a general design principle for
> > representing strings in erlang terms then a binary representation is
> > far more preferable than a "list of integers"?
> 1) do people tend to agree with Joe's guidance in that exchange
> re:couchdb, and if so why isn't it plastered all over the tutorials?
> 3) Shouldn't the word "string" be banned from the debate about text in
> erlang apart from as a reference to a specific foreign data type?
> 3) Are my questions too trite?
> erlang-questions mailing list
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions