<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<title></title>
<meta name="Generator" content="Cocoa HTML Writer">
<meta name="CocoaVersion" content="1265">
<style type="text/css">
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 15.0px; font: 12.0px Helvetica}
p.p2 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 15.0px; font: 12.0px Helvetica; min-height: 14.0px}
p.p3 {margin: 0.0px 0.0px 0.0px 12.0px; line-height: 14.0px; font: 12.0px Helvetica; color: #011892}
p.p4 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 14.0px; font: 12.0px Helvetica; min-height: 14.0px}
p.p5 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 14.0px; font: 12.0px Helvetica}
p.p6 {margin: 0.0px 0.0px 0.0px 0.0px; line-height: 14.0px; font: 12.0px Helvetica; color: #011892; min-height: 14.0px}
p.p7 {margin: 0.0px 0.0px 0.0px 12.0px; line-height: 14.0px; font: 12.0px Helvetica; color: #011892; min-height: 14.0px}
</style>
</head>
<body>
<p class="p1">On 2014-02-01 21:08:59 +0000, Loïc Hoguin said:</p>
<p class="p2"><br></p>
<p class="p3">I think for most users and most use cases maps will completely take over<span class="Apple-converted-space"> </span></p>
<p class="p3">records.</p>
<p class="p4"><br></p>
<p class="p5">I really hope you are not right with this (but I fear that you might be).<span class="Apple-converted-space">  </span>Erlang with maps for everything will be a poorer language.</p>
<p class="p6"><br></p>
<p class="p3">Reason 2: Upgrading a process state that uses records is terrifying.</p>
<p class="p4"><br></p>
<p class="p5">Upgrading a process state *should* terrify you a bit,<span class="Apple-converted-space">  </span>because it has the potential of undetected corruption of state.</p>
<p class="p4"><br></p>
<p class="p3">Well here's a good explanation of why it's terrifying and sucks<span class="Apple-converted-space"> </span></p>
<p class="p3">horribly:<span class="Apple-converted-space"> </span></p>
<p class="p3">http://erlang.org/pipermail/erlang-questions/2014-February/076765.html</p>
<p class="p4"><br></p>
<p class="p5">For me thats exactly the opposite.</p>
<p class="p4"><br></p>
<p class="p3">For maps at worst you just do M#{ new_field => default_value } and are<span class="Apple-converted-space"> </span></p>
<p class="p3">done with it.</p>
<p class="p4"><br></p>
<p class="p5">Or not if you broke your state.</p>
<p class="p4"><br></p>
<p class="p3">Reason 3: Records are cumbersome to use.</p>
<p class="p7"><br></p>
<p class="p3">Many hate the record syntax. Many also would prefer to avoid the record<span class="Apple-converted-space"> </span></p>
<p class="p3">definition entirely when prototyping some code. And they should! Maps<span class="Apple-converted-space"> </span></p>
<p class="p3">aren't slowing down your work the way records do. And guess what. Most<span class="Apple-converted-space"> </span></p>
<p class="p3">of the time the prototype of an Erlang process is good enough for<span class="Apple-converted-space"> </span></p>
<p class="p3">production use.</p>
<p class="p4"><br></p>
<p class="p5">I neither hate the record syntax nor has ever defining a state record slowed my down. <span class="Apple-converted-space"> </span></p>
<p class="p4"><br></p>
<p class="p5">Maps<span class="Apple-converted-space">  </span>being used by everyone as state is the worst case scenario I can think of.</p>
<p class="p6"><br></p>
<p class="p3">You lose Dialyzer. That's the big drawback. But most processes' state is<span class="Apple-converted-space"> </span></p>
<p class="p3">smallish so mistakes are hard to make and quickly found anyway.</p>
<p class="p4"><br></p>
<p class="p5">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).</p>
<p class="p4"><br></p>
<p class="p5">So updates will be a rare occasion and therefor them being a bit complicated won't hur much.</p>
<p class="p4"><br></p>
<p class="p5">And for a rarely changing smallish state having to declare the record can't be that much overhead.</p>
<p class="p6"><br></p>
<p class="p3">These are the three main reasons I think maps will take over. Personally<span class="Apple-converted-space"> </span></p>
<p class="p3">I will probably still use records for most processes' state<span class="Apple-converted-space"> </span></p>
<p class="p4"><br></p>
<p class="p5">Good to hear :-)</p>
<p class="p4"><br></p>
<p class="p3">Maps will also completely beat proplists to death, burn their brackets<span class="Apple-converted-space"> </span></p>
<p class="p3">and eat their hearts. I don't think I need to explain why.</p>
<p class="p4"><br></p>
<p class="p5">Id be not so extreme dismembering proplists, but mostly agree on this.</p>
<p class="p4"><br></p>
<p class="p5">Cheers,</p>
<p class="p5">-- Peer</p>
</body>
</html>