[erlang-questions] [ANN] Erlang/OTP 17.0-rc1 has been released.
Peer Stritzinger
peerst@REDACTED
Sun Feb 2 14:55:02 CET 2014
On 2014-02-01 21:08:59 +0000, Loïc Hoguin said:
> I think for most users and most use cases maps will completely take over
> records.
I really hope you are not right with this (but I fear that you might
be). Erlang with maps for everything will be a poorer language.
> Reason 2: Upgrading a process state that uses records is terrifying.
Upgrading a process state *should* terrify you a bit, because it has
the potential of undetected corruption of state.
> Well here's a good explanation of why it's terrifying and sucks
> horribly:
> http://erlang.org/pipermail/erlang-questions/2014-February/076765.html
For me thats exactly the opposite.
> For maps at worst you just do M#{ new_field => default_value } and are
> done with it.
Or not if you broke your state.
> Reason 3: Records are cumbersome to use.
>
> Many hate the record syntax. Many also would prefer to avoid the record
> definition entirely when prototyping some code. And they should! Maps
> aren't slowing down your work the way records do. And guess what. Most
> of the time the prototype of an Erlang process is good enough for
> production use.
I neither hate the record syntax nor has ever defining a state record
slowed my down.
Maps being used by everyone as state is the worst case scenario I can
think of.
> You lose Dialyzer. That's the big drawback. But most processes' state is
> smallish so mistakes are hard to make and quickly found anyway.
If a state is smallish (as it should be most of the time) then it can't
be added to that often in updates (otherwise it would soon be no longer
smallish).
So updates will be a rare occasion and therefor them being a bit
complicated won't hur much.
And for a rarely changing smallish state having to declare the record
can't be that much overhead.
> These are the three main reasons I think maps will take over. Personally
> I will probably still use records for most processes' state
Good to hear :-)
> Maps will also completely beat proplists to death, burn their brackets
> and eat their hearts. I don't think I need to explain why.
Id be not so extreme dismembering proplists, but mostly agree on this.
Cheers,
-- Peer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20140202/09456e1f/attachment.htm>
More information about the erlang-questions
mailing list