[erlang-questions] Re: Concept of Side-effect

Masklinn masklinn@REDACTED
Fri Sep 18 10:22:30 CEST 2009


On 18 Sep 2009, at 04:34 , Kaiduan Xie wrote:
> Thanks Benjamin, but sometimes printing out to the console is really
> what you want. Maybe this is not a good example :)
>

The qualification of a side-effect as side-effect doesn't depend on  
"what you want", sometimes you want side-effects (indeed, programming  
would be quite uninteresting if we were only allowed pure constructs).

A side-effect is simply a contact with a state, either reading from or  
writing to a state holder. In the case of your io:format, you're  
writing to the console and altering its state (by adding a new line  
with your printed string each time).


More information about the erlang-questions mailing list