Data structures
- Literals
- atoms: foo, bar…
- numbers: 123, 1.23…
- bool: true, false
- Compound structures
- tuples: {foo, 12, {bar, zot}}
- listis: [], [1, 2, foo, bar]
Variables
- lexically scoped
- implicit scoping - the procedure definition
- untyped - assigned a value when introduced
- syntax: X, Foo, BarZot, _anything
No circular structures
circular data structures: the last element is a pointer to the first.
Concurrency
Concurrency is explicitly controlled by creation (spawning) of processes.
A process is when created, given a function to evaluate. no one cares about the result.
Sending and receiving messages is the only way to communicate with a process.
no shared state
Registration
A node registers associate names to process identifiers.
register(alarm_process, Pid)
Knowing the registered name of a process you can look-up the process identifier.
The register is a shared data structure!
Node
Erlang nodes (an Erlang virtual machine) can be connected in a group .
Each node has a unique name.
Processes in one node can send messages to and receive messages from processes in other nodes using the same language constructs.
Failure detection
- a process can monitor another process
- if the process dies a messages is placed in the message queue
- the message will indicate if the termination was normal or
abnormal or ….. if the communication was lost
Atomic termination
- A process can link to another process, if the process dies with an
exception the linked process will die with the same exception.
- Processes that depend on each other are often linked together, if
one dies they all die.