-
Website
http://20bits.com -
Original page
http://20bits.com/articles/erlang-an-introduction-to-records/ -
Subscribe
All Comments -
Community
-
Top Commenters
-
prissypot13
3 comments · 1 points
-
Felix Purnama
4 comments · 1 points
-
hadley
2 comments · 1 points
-
adamheroku
2 comments · 3 points
-
twiss
2 comments · 1 points
-
-
Popular Threads
Opts = #server_opts{port=80, ip="192.168.0.1"},
NewOpts = Opts#{port=7000}.
should look like this:
Opts = #server_opts{port=80, ip="192.168.0.1"},
NewOpts = Opts#server_opts{port=7000}.
> Perhaps a subset of the first, records are also used to keep track of configurable options.
Yes, records may be used for this. But sometimes proplists are better choice, take a look at http://www.erlang.org/doc/man/proplists.html:
> Property lists are useful for representing inherited properties, such as
> options passed to a function where a user may specify options overriding
> the default settings, object properties, annotations, etc.
I'm not sure if you're a real person or a spam bot, but by "a la PHP, Ruby, or Python" I meant as a first-order construct. I'll reword it so it's less ambiguous.
Good catch. And thanks for pointing to proplists, I didn't know about them.
You have a slight mistake thought:
"Since Erlang is side-effect free state cannot be kept globally."
What I think you meant was that Erlang is a functional language. Functional languages don't have state. Imperative do.
Erlang is not side-effect free language. Printing to the console is not a side-effect free operation and you can do it from virtually everywhere in Erlang. A side effect free language would be useless - you won't be able to communicate with anything (terminal, socket, etc.). Haskell can be thought of being a side-effect free, where side effects are controller by monads.
Regards