[erlang-questions] Vector instructions
Ulf Wiger (TN/EAB)
Mon Apr 7 09:22:57 CEST 2008
In the U.S. there is a phrase, "Monday morning quarterback",
referring to all those who watched the football games on
Sunday, and come Monday are ready to tell the world how
they would have played the game differently.
> This is the same kind of mistakes, like 2 bad design decisions
> made in Erlang:
> 1. "Ohh, record looks just like a tuple!", so let's throw in
> some syntactic sugar for this, instead of real immutable
At the time when records were introduced, there were no
available type tags in the virtual machine, so adding real
structs would have involved major redesign of the VM.
There /was/, however, a real need for some sort of "struct"
support. The design was subject to intense debate, but just
about all agreed that the final result would be a compromise.
(The tag scheme was changed later, so nowadays it would be
possible to introduce a new type.)
> 2. "Ohh, string looks just like a list of integers!", so let's
> throw in some syntactic sugar for this, instead of
> implementing real Unicode-aware immutable string datatype.
In keeping with the philosophy to try to keep the language
as small as possible in the beginning, using lists of integers
as strings was perfectly logical and, as RoK has pointed out
several times, actually quite a good strategy in many respects.
Later, a 'binary' data type was introduced in order to handle
protocol packets etc as chunks of bytes. While binaries could
have replaced lists for string representation, it would have
given worse characteristics in almost every respect except
memory usage and substring by position.
And there really was very little demand for Unicode when Erlang
was first designed. Indeed, the earliest documented use of the
term "Unicode" was in December 1987 (according to unicode.org).
Back then, the subject of intense debate in the Erlang camp
(according to Joe's History of Erlang) was how to get concurrency
right. I think they had their priorities straight.
The Unicode standard version 1.0 was printed in June 1992. At
that time, the Erlang language was considered fairly stable.
In 1993, Distributed Erlang was implemented by Klacke, and
Tim Berners-Lee wrote the first HTML draft. The term "web
application" wasn't yet popular, even though TBL had
described "a multiply connected 'web'" in an information
management proposal back in 1989
(http://www.w3.org/History/1989/proposal.html), and the first
"WorldWideWeb" browser was demonstrated at the end of 1990.
The first non-European web server was set up in Stanford in
Dial-up Internet access started appearing in 1994.
Java first saw the light of day in 1995:
"Java, in its JDK 1.0 incarnation, had the beginnings of
international support, because a Java char is stored as a
Unicode character. But that was all. You couldn't enter or
display non-Latin characters, and there were no facilities
for language-sensitive formatting, sorting, and so on."
More or less complete support for Unicode didn't come until
JDK 2.0 in 1998, which was also the year when XML 1.0 came
out. It was also the year when the AXD 301 was released,
one of the biggest commercial product development projects
ever undertaken using a functional language.
After 1998, Erlang had millions of lines of legacy code to
consider, so any major changes to the language had to be
considered with utmost care.
One may also note that back in those days, string handling
was not an important factor in telecoms protocol design. All
protocols were byte coded, and work on a good bit syntax had
higher priority than improving string and regexp support.
More information about the erlang-questions