[erlang-questions] Does Erlang pure functional programming language?

Masklinn masklinn@REDACTED
Thu Jan 19 16:04:24 CET 2012


On 2012-01-19, at 15:52 , Gleb Peregud wrote:
> On Thu, Jan 19, 2012 at 15:50, Abdul Fattah Mahran
> <abdoo.mahran@REDACTED> wrote:
>> Hi Attila,
>> I can find this link
>> http://www.trapexit.org/Erlang_and_Neural_Networks#State_of_the_Purely_Functional
>> section 1.4 and it states that Erlang is pure, please advice?
> 
> It's incorrect. It is possible to write a pure functions in Erlang,
> but it is possible to have side effects like:
> - sending messages to other processes (changes state of other process)
> - mutating own process dictionary
> - manipulating ETS tables
> - changing things like operating system environmental variables, etc.
Although sequential erlang is very, very close to a pure language:
* No messages to other processes
* No ETS tables? I don't think ets tables can be stored in-process
* I'm guessing many changes (such as ENVVARs) delegate to port drivers, which would not be available to sequential erlang (an Erlang unable to send or receive messages)

which leaves process dictionary mutation.

Of course, in reality Erlang is not just sequential erlang, and any function call can hide sends and receives.


More information about the erlang-questions mailing list