Erlang Programming Language

Erlang is a general-purpose concurrent programming language and runtime system. The sequential sub-set of Erlang is a functional language, with strict evaluation, single assignment and dynamic typing. It was designed at Ericsson to support distributed, fault-tolerant, soft-real-time, non-stop applications. It is named after A. K. Erlang. It is sometimes mistakenly thought that its name is as abbreviation of ERicsson LANGuage, owing to its heavy use inside Ericsson.

Functional language

Code looks like this:
  -module(fact).  -export(fac/1).    fac(0) -> 1;  fac(N) where N > 0 -> N * fac(N-1). 
Below is an implementation of a Quicksort algorithm.
  %% quicksort(List)  %% Sort a list of items  -module(quicksort).  -export(qsort/1).    qsort([]) -> [];  qsort(Pivot|Rest) ->      qsort(|| X <- Rest, X < Pivot) ++ Pivot ++ qsort(|| Y <- Rest, Y >= Pivot). 
The above example recursively calls the function qsort until there is no more to be sorted. The expression || X <- Rest, X < Pivot can be read as "Chose all X where X is a member of Rest and X is less then Pivot", resulting in a very easy way of handling Lists. Since you can evaluate any boolean expression between two different datatypes, the evaluation is straight forward - for example, 1 < a will return true. However, a compare function can be used if the order on which Erlang bases its return value (true or false) needs to be changed. For example, if we would want an ordered list where a > 1 evaluates true.

Concurency oriented language

Main strength of Erlang is support for concurrency. It has small but powerful set of primitives to create threads and communicate between them. Location of thread is transparent (it can be within the same operating system process or on different computer). Code examples:
   Pid = spawn(Mod, Func, Args)     % execute function Func as new thread 
   Pid ! a_message      % send message to the thread (asynchronously) 
   receive       % receive message sent to this thread     a_message -> do_something   end. 
Erlang contains mechamisms to deal with errors and to ensure high availability of the whole system. Dynamical replacement of code (hot swapping) is supported.

Distribution

Erlang was released as open source to ensure its dependence on single source and to increase awareness of the language. Distribution of the language together with libraries and real-time distributed database is known as Open Telecom Platform, OTP. Ericsson offers commercial support for Erlang. Since taking the open source path in 1998, it became used by several companies world-wide, including Nortel and T-Mobile. However, it didn't and hasn't yet become a wide-spread mainstream programming language. As of 2005, Erlang is under active development with regular releases. It is available for several UNIXes and Windows.

Advantages

  • superb support for concurency (it is no problem to create hundreds of thousands of threads)
  • high programmer productivity (Ericsson study claim 4x higher than C)
  • small and simple to learn: Erlang is not academic language but real-world tool designed to be useable by Ericsson programmers
  • scalability: large systems with millions lines of code were written in Erlang

Disadvantages

  • not intended for high-performance applications (interpreted language, uses garbage collection)
  • lack of static typing: many errors are caught only during runtime
  • as it is not a mainstream language there are not many tools, books, libraries and skilled developers. For example GUI support is still in the beginning.

See also

External links

 

<< PreviousWord BrowserNext >>
edinburgh
ernest rutherford, 1st baron rutherford of nelson
many worlds interpretation
ergonomics
electronic commerce
euler's formula
eductor jet pump
douard manet
evolutionarily stable strategy
element
extremophile
education reform
ellensburg, washington
eugene, oregon
elizabeth barrett browning
enlil
ecology
english country dance
ecosystem
e (mathematical constant)
euler maclaurin formula
epimenides paradox
engine
economic and monetary union
european environment agency
ev
euphoria programming language
energy
expected value
edison
electric light
edgar rice burroughs
eugne viollet le duc
endocarditis
euler's conjecture
exodus
electronics
erewhon
ectopia
ec
entorhinal cortex
ernst haeckel
evolutionism
entscheidungsproblem