<div dir="ltr">Wow, time flies... has it been that long? Anyway, I found this old branch and decided to rework it like Kenneth suggested. Here's the PR: <a href="https://github.com/erlang/otp/pull/1265">https://github.com/erlang/otp/pull/1265</a><br></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><br> /Richard</div></div>
<br><div class="gmail_quote">2012-02-14 12:24 GMT+01:00 Kenneth Lundin <span dir="ltr"><<a href="mailto:kenneth.lundin@gmail.com" target="_blank">kenneth.lundin@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div>I think atoms introduced in both -type and -spec should be respected in this feature. If you want to </div>
<div>guard yourself against a misspelled atom in one -spec you can use -type but you are not forced to.</div>
<div> </div>
<div>And if you introduce an atom in a -spec and never use it in the code then you could maybe issue a warning for that too.</div>
<div> </div>
<div>/Kenneth<br><br></div>
<div class="gmail_quote">On Tue, Feb 14, 2012 at 10:47 AM, Richard Carlsson <span dir="ltr"><<a href="mailto:carlsson.richard@gmail.com" target="_blank">carlsson.richard@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT:1ex;MARGIN:0px 0px 0px 0.8ex;BORDER-LEFT:#ccc 1px solid"><span class="">
<div class="m_-5983025024420299269im">On 02/14/2012 09:44 AM, Kenneth Lundin wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT:1ex;MARGIN:0px 0px 0px 0.8ex;BORDER-LEFT:#ccc 1px solid">Hi,<br>I don't think this is a good way to introduce declared atoms.<br>We already have the -type and -spec notation for definition of<br>
types and function signatures which are then used by Dialyzer for type<br>checking.<br>I don't think we should introduce yet another notation that is not<br>harmonized with -type and -spec.<br>It is already possible to declare atoms in -type and -spec. Why not use<br>
this already present notation and add<br>optional checking of atoms against declared atoms inside -type and -spec<br>instead.<br>With the suggested -atom declaration we will probably get the same atoms<br>declared 2 times with different notations and I think that<br>
will clutter down the code with redundant information to an<br>unacceptable degree.<br></blockquote><br></div></span>Yes, that is probably a better idea: that any atom occurring in a -type and/or -spec declaration is implicitly said to be known, and others are not. This would be an incentive for people to define types for things like the set of messages to a server or the set of atoms allowed as flags to a function (or error codes returned from a function).<br>
<br>The question is, should atoms occurring in -spec declarations be taken as implicit "exists"-declarations, or should it only be those in -type? If it's only -type that counts, you could get checking of the atoms in -spec declarations as well, so you don't spell an atom wrong in the spec for one of 3 versions of a function and suddenly that atom is also implicitly allowed. I think -type only is the right way.<br>
<br>I'll see if I can change my patch to do this instead.<br><font color="#888888"><br> /Richard<br></font></blockquote></div><br>
</blockquote></div><br></div>