<div dir="auto">Thanks a lot Nicolas. <div dir="auto"><br></div><div dir="auto">Will go through, and then may be express my hunch that this is a way in which details are either leaking and/or is not sufficient at the level of a type spec. But who knows I endup correcting myself after a little follow up.<br><br><div data-smartmail="gmail_signature" dir="auto">नमस्ते।<br>नलिन रंजन</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, Jan 26, 2021, 10:05 PM Nicolas Martyanoff <<a href="mailto:khaelin@gmail.com">khaelin@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 2021-01-26 21:46, Nalin Ranjan wrote:<br>
> 2. In this particular case of type specification, the only difference is in<br>
> one of the parameters of the function. I was also wondering if we could<br>
> have used a union instead to write the same type spec, it would have been<br>
> simpler?<br>
> For example,<br>
> Instead of writing a type spec like this<br>
> <br>
> -ifdef(SOME_PRAGMA_CONDITION)<br>
> SomeVar :: xxx_type().<br>
> -else<br>
> SomeVar :: yyy_type().<br>
> <br>
> We could specify the same type spec as:<br>
> SomeVar :: xxx_type() | yyy_type().<br>
> <br>
> Any reason we preferred the former over the latter?<br>
<br>
If Erlang is compiled without socket support, some types will not exist at<br>
all. Using the preprocessor[1] makes it possible to provide specifications<br>
with types which actually exist, with or without socket support.<br>
<br>
[1] <a href="https://erlang.org/doc/reference_manual/macros.html" rel="noreferrer noreferrer" target="_blank">https://erlang.org/doc/reference_manual/macros.html</a><br>
<br>
-- <br>
Nicolas Martyanoff<br>
<a href="http://snowsyn.net" rel="noreferrer noreferrer" target="_blank">http://snowsyn.net</a><br>
<a href="mailto:khaelin@gmail.com" target="_blank" rel="noreferrer">khaelin@gmail.com</a><br>
</blockquote></div>