<html>
<head>
<meta content="text/html; charset=windows-1252"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 2015-01-05 23:43, José Valim wrote:<br>
</div>
<blockquote
cite="mid:CAGnRm4+rssH_DApxHyZEXjqMYRHPRGDY-0PjxDUadD41=-r9vQ@mail.gmail.com"
type="cite">
<div dir="ltr">Hello everyone,
<div><br>
</div>
<div>The <a moz-do-not-send="true"
href="http://www.erlang.org/doc/reference_manual/typespec.html">typespecs</a> documentation
says dialyzer does not yet use map pairs information (which is
fine). The issue is that it does not describe what are the
semantic implications of map pairs in types. To be clear, the
following type:</div>
<div><br>
</div>
<blockquote style="margin:0 0 0 40px;border:none;padding:0px">
<div>#{foo => any()}</div>
</blockquote>
<div>
<div>
<div class="gmail_signature">
<div><br>
</div>
<div>should:</div>
<div><br>
</div>
<div>1) match maps containing only the key foo</div>
<div>2) match maps containing at least the key foo</div>
</div>
</div>
</div>
</div>
</blockquote>
<br>
We've had some debate on this. Especially regarding mandatory and/or
optional fields.<br>
<br>
From my viewpoint your second point is the correct one. You must
specify the fields and types that are needed for your function to
succeed.<br>
<br>
I don't think it should be an error to over specify the fields (more
keys than needed). Perhaps you want to construct a -type with a map
with several fields but different fields are used in different
functions where you specify that you are using this type.<br>
<br>
<blockquote
cite="mid:CAGnRm4+rssH_DApxHyZEXjqMYRHPRGDY-0PjxDUadD41=-r9vQ@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>
<div>
<div class="gmail_signature">Additionally, what would #{_
=> _} mean in any of the schemas above?</div>
</div>
</div>
</div>
</blockquote>
<br>
This is essentially what we are saying today .. though i would
refrain from specifying it with underscore, #{ any() => any() }
is a bit clearer.<br>
Our contract says we accept a map containing any keys with any
values, which is not very useful but valid. The jury is still out on
empty map though.<br>
<br>
<br>
// Björn-Egil<br>
<br>
<blockquote
cite="mid:CAGnRm4+rssH_DApxHyZEXjqMYRHPRGDY-0PjxDUadD41=-r9vQ@mail.gmail.com"
type="cite">
<div dir="ltr">
<div>
<div>
<div class="gmail_signature">
<div><br>
</div>
<div><span style="font-size:13px">
<div><span
style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse"><b>José
Valim</b></span></div>
<div><span
style="font-family:arial,sans-serif;font-size:13px;border-collapse:collapse">
<div><span
style="font-family:verdana,sans-serif;font-size:x-small"><a
moz-do-not-send="true"
href="http://www.plataformatec.com.br/"
style="color:rgb(42,93,176)" target="_blank">www.plataformatec.com.br</a></span></div>
<div><span
style="font-family:verdana,sans-serif;font-size:x-small">Skype:
jv.ptec</span></div>
<div><span
style="font-family:verdana,sans-serif;font-size:x-small">Founder
and Lead Developer</span></div>
</span></div>
</span></div>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
erlang-questions mailing list
<a class="moz-txt-link-abbreviated" href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a>
<a class="moz-txt-link-freetext" href="http://erlang.org/mailman/listinfo/erlang-questions">http://erlang.org/mailman/listinfo/erlang-questions</a>
</pre>
</blockquote>
<br>
</body>
</html>