[erlang-questions] Strings and Text Processing

Jesper Louis Andersen jesper.louis.andersen@REDACTED
Thu Jan 3 10:36:53 CET 2013



On Dec 29, 2012, at 3:08 PM, Steve Davis <steven.charles.davis@REDACTED> wrote:

> 2) If not, I wonder if there's any way to change our minds about "strings" as we enter 2013?

There is :)

A String is often a notoriously bad way to represent data. Think about it: a string is really just a sequence of bytes with some interpretation (utf8 is common). The problem is that people tend to keep their data represented as strings where other data structures are better for the purpose. A Comma-separated file for instance is better represented as a list of tuples or a generator of tuples (and/or records).

The reason you don't usually need a lot of syntactic sugar for manipulating strings are simply that you shouldn't be manipulating strings too much in the first case. A language like Perl is good for processing directly on text, but the weakness is that it has a harder time at structuring data like you should do in Erlang (Or ML or Haskell or …). I have a hunch that most of the critique is really due to the fact that people are trying to write in the style of a different language in Erlang.

Jesper Louis Andersen
  Erlang Solutions Ltd., Copenhagen




More information about the erlang-questions mailing list