<div dir="ltr"><div>To summon up this thread with my view.</div><div><br></div><div>We want both Frames and Dictionaries.</div><div><br></div><div>Frames for it's small memory footprint and fast access, can replace records except in the most </div>
<div>time critical places.</div><div><br></div><div>Dictionaries for it's arbitrary key terms and the ability to handle many objects.</div><div><br></div><div>Matching is nice so we want have syntax to use them both, we do not want to introduce two</div>
<div>new syntax's in the language because that will make it harder to read and learn.</div><div><br></div><div><table cellpadding="0" class="" style="width:417.272705078125px;font-family:arial,sans-serif;font-size:12.727272033691406px;white-space:nowrap">
<tbody><tr><td><div class=""><span name="Fred Hebert" class="">Fred Hebert</span></div><div class=""><span name="Fred Hebert" class="">>  #{_ := V} = #{a => 3},</span></div><div class="">> and variants.</div><div class="">
<br></div><div class="">Value searching will not be allowed.<br></div><div class=""><br></div><div class=""><div class="">Richard A. O'Keefe</div><div class="">> Frames</div><div class="">></div><div class="">Maps are basically an extension of Frames which allows for arbitrary key terms.</div>
<div class="">Which could use your implementation proposal for small maps defined in source code,  </div><div class="">and switches to a tree (or something else) for larger dynamic sized Maps.</div><div></div></div></td></tr>
</tbody></table><span style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:12.727272033691406px">>- Frames are limited to atom keys in the interests of</span><br style="font-family:arial,sans-serif;font-size:12.727272033691406px">
<span style="font-family:arial,sans-serif;font-size:12.727272033691406px">> compile-time error detection (both simply noticing that</span><br style="font-family:arial,sans-serif;font-size:12.727272033691406px"><span style="font-family:arial,sans-serif;font-size:12.727272033691406px">>  a key is not an atom at all and allowing the possibility</span><br style="font-family:arial,sans-serif;font-size:12.727272033691406px">
<span style="font-family:arial,sans-serif;font-size:12.727272033691406px">>  of Dialyzer support).</span><br style="font-family:arial,sans-serif;font-size:12.727272033691406px"></div><div><span style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br>
</span></div><div><span style="font-family:arial,sans-serif;font-size:12.727272033691406px">So use := and you will get a runtime/compile check that the key exists.</span></div><div><span style="font-family:arial,sans-serif;font-size:12.727272033691406px"><br>
</span></div><div><div><font face="arial, sans-serif">>- Frames have O(lg N) access to a single field or O(N/k) access</font></div><div><font face="arial, sans-serif">>  to k fields.  They have O(N/k) cost for copying a frame with</font></div>
<div><font face="arial, sans-serif">>  k fields changed.</font></div><div style="font-size:12.727272033691406px;font-family:arial,sans-serif"><br></div><div style="font-size:12.727272033691406px;font-family:arial,sans-serif">
You will still have that for small maps.</div><div style="font-size:12.727272033691406px;font-family:arial,sans-serif"><br></div><div style="font-size:12.727272033691406px;font-family:arial,sans-serif">Robert Virding</div>
<div style="font-size:12.727272033691406px;font-family:arial,sans-serif">> Use only matching</div><div style="font-size:12.727272033691406px;font-family:arial,sans-serif"><br></div><div style="font-size:12.727272033691406px;font-family:arial,sans-serif">
We would like to but we believe we can not do that because we can't output a defined order, </div><div style="font-size:12.727272033691406px;font-family:arial,sans-serif">i.e. you can not sort 1.0 and 1.</div><div style="font-size:12.727272033691406px;font-family:arial,sans-serif">
We would need to define a new term order in erlang and we need to introduce something</div><div style="font-size:12.727272033691406px;font-family:arial,sans-serif">like <:<, >:> =:< and >:=.</div><div style="font-size:12.727272033691406px;font-family:arial,sans-serif">
<br></div><div style="font-size:12.727272033691406px;font-family:arial,sans-serif">/Dan</div></div><div><br></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Tue, May 14, 2013 at 3:41 PM, Max Lapshin <span dir="ltr"><<a href="mailto:max.lapshin@gmail.com" target="_blank">max.lapshin@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I think, that first problem is a convenient syntax for key-value<br>
structure. Syntax that will also work for pattern matching, not also<br>
editing existing structure.<br>
<br>
Second problem is a distinguishing between tuples and this special<br>
type. Many of us have problems trying to understand: is this a list of<br>
integers or a string? How should I pack it to json? As a result, many<br>
modern pieces of software are migrating to binary-only.<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br>
<a href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://erlang.org/mailman/listinfo/erlang-questions</a><br>
</div></div></blockquote></div><br></div>