Saturday, 8 November 2008

The Erlang Rationale - Characters and strings

This is one non-terminating discussion we had.

There have been many suggestions whether to have a proper type character data type or to leave them as integers. While adding a new type would not have been difficult we could not quite agree as to whether we should do it. If so which encoding should we use, stay with ASCII or go to ISO-8859-1 (Latin1) or UNICODE? If we changed to UNICODE should we also allow that in atoms as well? In the end we decided not to add a character type but make sure we could handle Latin1 in the libraries. As our primary application area was not handling text we felt that this was sufficient.

Very early on we decided that strings were lists. This was partly environment as many of the languages we were using, such as Prolog, use lists and partly practical as lists are a very powerful data type.

Using a general data type like lists and having characters is seldom as problem as you usually know what if you are processing a list which is a string or if it is something else. It is only within generic functions like printing or the shell where you can have problems with such a general data type.

3 comments:

  1. Haha! "Non-terminating," I get it!

    ReplyDelete
  2. Yes, there have been some things for which we have never been able to find a good final solution.

    ReplyDelete
  3. Now we can even bring around all those objects and provisions of ideas which are even said to be of utmost importance. homepage

    ReplyDelete