Erlang is a functional languages containing also primitives which implement the Actors Model of Concurrency.
The Actors Model of concurrency is sometimes also referred to as
Agents Model. Let us briefly recall the Actors Model of Concurrency (notes by Sander Sonajalg).
The Actors Model of Concurrency requires no sharing of resources. This is why a functional language is best suited for implementing it.
The Actor Model requires actors to possibly possess a state.
Erlang is an untyped language. Better, it is a dinamically typed language.
Besides base types (boolean, integers, etc.) Erlang can structure values of various types using tuples and lists. Erlang tuples are like PICT tuples (with '{' and '}' instead of '[' and ']') List are denoted using a sintax similar to the one of PROLOG: [] is the empty list, [X|XS] is the list having X as first element and XS as rest of the list. Tuples can be used, like in PICT, to form patterns. Patterns are tipically formed using values (among which atoms), variables, and the tuple constructor. In Erlang pattern mathing can be used like in Haskell, in function definitions, or like in PICT, for input operations (receive). Function definitions are very similar to Haskell, apart from sintactical differences. A basic type in Erlang is the one of Atoms. Erlang atoms are exactly like the atoms in PROLOG: an atom is a name having itself as value. Atoms are used in tuples usually in order to denote what sort of message we are sending/receiving. In Erlang, atoms are identifiers beginning with a lower-case letter, whereas variables are identifiers beginning with an Upper-case letter. It is possible to associate a value to a variable by means of the '=' operator (directly or by means of pattern matching).
Besides built-in types, in Erlang it is also possible
to define new types and provide type specifications for functions.
As in PROLOG, Erlang is provided with many BIF (Built In Functions) enabling the programmer to check inside the program the types of the values used. So Erlang uses a completely different approach to types w.r.t. Haskell and static typing in general. Erlang is a language with a call-by-value evaluation strategy.
|