<div dir="ltr"><a href="https://erlang.org/doc/man/net.html#getnameinfo-2">Type</a> of net:getnameinfo() is specified in the <a href="https://github.com/erlang/otp/blob/master/lib/kernel/src/net.erl#L203">source file</a>, and the one prevailing in the docs is as below:-<div><br></div><div><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container" style="border-spacing:0px;border-collapse:collapse;color:rgb(216,212,207);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px;background-color:rgb(19,21,22)"><tbody style="box-sizing:border-box"><tr style="box-sizing:border-box;background-color:transparent"><td id="gmail-LC220" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;white-space:pre;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace"><span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(255,115,105)">-</span><span class="gmail-pl-c1" style="box-sizing:border-box;color:rgb(110,192,255)">spec</span> <span class="gmail-pl-en" style="box-sizing:border-box;color:rgb(197,143,255)">getnameinfo</span>(<span class="gmail-pl-smi" style="box-sizing:border-box;color:rgb(188,182,173)">SockAddr</span>, <span class="gmail-pl-smi" style="box-sizing:border-box;color:rgb(188,182,173)">Flags</span>) <span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(255,115,105)">-></span> {<span class="gmail-pl-c1" style="box-sizing:border-box;color:rgb(110,192,255)">ok</span>, <span class="gmail-pl-smi" style="box-sizing:border-box;color:rgb(188,182,173)">Info</span>} | {<span class="gmail-pl-c1" style="box-sizing:border-box;color:rgb(110,192,255)">error</span>, <span class="gmail-pl-smi" style="box-sizing:border-box;color:rgb(188,182,173)">Reason</span>} <span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(255,115,105)">when</span></td></tr><tr style="box-sizing:border-box"><td id="gmail-L221" class="gmail-blob-num gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;line-height:20px;color:rgba(211,207,201,0.3);text-align:right;white-space:nowrap;vertical-align:top;border-right:0px"></td><td id="gmail-LC221" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;white-space:pre;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace">      <span class="gmail-pl-smi" style="box-sizing:border-box;color:rgb(188,182,173)">SockAddr</span> <span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(255,115,105)">::</span> <span class="gmail-pl-en" style="box-sizing:border-box;color:rgb(197,143,255)">term</span>(),</td></tr><tr style="box-sizing:border-box;background-color:transparent"><td id="gmail-L222" class="gmail-blob-num gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;line-height:20px;color:rgba(211,207,201,0.3);text-align:right;white-space:nowrap;vertical-align:top;border-right:0px"></td><td id="gmail-LC222" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;white-space:pre;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace">      <span class="gmail-pl-smi" style="box-sizing:border-box;color:rgb(188,182,173)">Flags</span>    <span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(255,115,105)">::</span> <span class="gmail-pl-en" style="box-sizing:border-box;color:rgb(197,143,255)">name_info_flags</span>() | <span class="gmail-pl-c1" style="box-sizing:border-box;color:rgb(110,192,255)">undefined</span>,</td></tr><tr style="box-sizing:border-box"><td id="gmail-L223" class="gmail-blob-num gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;line-height:20px;color:rgba(211,207,201,0.3);text-align:right;white-space:nowrap;vertical-align:top;border-right:0px"></td><td id="gmail-LC223" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;white-space:pre;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace">      <span class="gmail-pl-smi" style="box-sizing:border-box;color:rgb(188,182,173)">Info</span>     <span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(255,115,105)">::</span> <span class="gmail-pl-en" style="box-sizing:border-box;color:rgb(197,143,255)">name_info</span>(),</td></tr><tr style="box-sizing:border-box;background-color:transparent"><td id="gmail-L224" class="gmail-blob-num gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;line-height:20px;color:rgba(211,207,201,0.3);text-align:right;white-space:nowrap;vertical-align:top;border-right:0px"></td><td id="gmail-LC224" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;white-space:pre;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace">      <span class="gmail-pl-smi" style="box-sizing:border-box;color:rgb(188,182,173)">Reason</span>   <span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(255,115,105)">::</span> <span class="gmail-pl-en" style="box-sizing:border-box;color:rgb(197,143,255)">term</span>().</td></tr></tbody></table></div><div><br></div><div>Currently, the type is <span class="gmail-pl-smi" style="box-sizing:border-box;color:rgb(188,182,173);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre;background-color:rgb(19,21,22)">SockAddr</span><span style="color:rgb(216,212,207);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre;background-color:rgb(19,21,22)"> </span><span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(255,115,105);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre;background-color:rgb(19,21,22)">::</span><span style="color:rgb(216,212,207);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre;background-color:rgb(19,21,22)"> </span><span class="gmail-pl-en" style="box-sizing:border-box;color:rgb(197,143,255);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre;background-color:rgb(19,21,22)">term</span><span style="color:rgb(216,212,207);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre;background-color:rgb(19,21,22)">(), and could have been </span><span class="gmail-pl-smi" style="box-sizing:border-box;color:rgb(188,182,173);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre;background-color:rgb(19,21,22)">SockAddr</span><span style="color:rgb(216,212,207);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre;background-color:rgb(19,21,22)"> </span><span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(255,115,105);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre;background-color:rgb(19,21,22)">::</span><span style="color:rgb(216,212,207);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre;background-color:rgb(19,21,22)"> </span><span class="gmail-pl-en" style="box-sizing:border-box;color:rgb(197,143,255);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre;background-color:rgb(19,21,22)">socket</span><span style="color:rgb(216,212,207);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre;background-color:rgb(19,21,22)">:</span><span class="gmail-pl-en" style="box-sizing:border-box;color:rgb(197,143,255);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre;background-color:rgb(19,21,22)">sockaddr</span><span style="color:rgb(216,212,207);font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;white-space:pre;background-color:rgb(19,21,22)">().</span><br></div><div><br></div><div>I think fixing it in the source at <a href="https://github.com/erlang/otp/blob/master/lib/kernel/src/net.erl#L221">L221</a> should fix it in the documentation as well. But please let me know if it doesn't.</div><div><br></div><div>However, I am myself confused about the way the type is specified, so thought I will discuss first before opening a PR. </div><div><br></div><div>It is not the net:getnameinfo/1 that I am confused, but about the net:getnameinfo/2. I don't understand the usage of <b>ifndef</b> and <b>else </b>while specifying this type specification. If you could please point me to a place where I can understand these 2 better. I don't want to make wild guesses here while I am working through the foundations of Erlang.</div><div><br></div><div>It could have been simpler had this specification been written like below, even though whatever "ifdef" is doing out there is to be taken into consideration:-</div><div> </div><div><table class="gmail-highlight gmail-tab-size gmail-js-file-line-container" style="border-spacing:0px;border-collapse:collapse;color:rgb(216,212,207);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji";font-size:14px;background-color:rgb(19,21,22)"><tbody style="box-sizing:border-box"><tr style="box-sizing:border-box"><td id="gmail-LC215" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;white-space:pre;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace"><span class="gmail-pl-smi" style="box-sizing:border-box;color:rgb(188,182,173)">SockAddr</span> <span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(255,115,105)">::</span> <span class="gmail-pl-en" style="box-sizing:border-box;color:rgb(197,143,255)">socket</span>:<span class="gmail-pl-en" style="box-sizing:border-box;color:rgb(197,143,255)">sockaddr</span>() | term(),</td></tr><tr style="box-sizing:border-box;background-color:transparent"><td id="gmail-L216" class="gmail-blob-num gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;line-height:20px;color:rgba(211,207,201,0.3);text-align:right;white-space:nowrap;vertical-align:top;border-right:0px"></td><td id="gmail-LC216" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;white-space:pre;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace"><span class="gmail-pl-smi" style="box-sizing:border-box;color:rgb(188,182,173)">Flags</span>    <span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(255,115,105)">::</span> <span class="gmail-pl-en" style="box-sizing:border-box;color:rgb(197,143,255)">name_info_flags</span>() | <span class="gmail-pl-c1" style="box-sizing:border-box;color:rgb(110,192,255)">undefined</span>,</td></tr><tr style="box-sizing:border-box"><td id="gmail-L217" class="gmail-blob-num gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;line-height:20px;color:rgba(211,207,201,0.3);text-align:right;white-space:nowrap;vertical-align:top;border-right:0px"></td><td id="gmail-LC217" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;white-space:pre;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace"><span class="gmail-pl-smi" style="box-sizing:border-box;color:rgb(188,182,173)">Info</span>     <span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(255,115,105)">::</span> <span class="gmail-pl-en" style="box-sizing:border-box;color:rgb(197,143,255)">name_info</span>(),</td></tr><tr style="box-sizing:border-box;background-color:transparent"><td id="gmail-L218" class="gmail-blob-num gmail-js-line-number" style="box-sizing:border-box;padding:0px 10px;width:50px;min-width:50px;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace;font-size:12px;line-height:20px;color:rgba(211,207,201,0.3);text-align:right;white-space:nowrap;vertical-align:top;border-right:0px"></td><td id="gmail-LC218" class="gmail-blob-code gmail-blob-code-inner gmail-js-file-line" style="box-sizing:border-box;padding:0px 10px;line-height:20px;vertical-align:top;overflow:visible;font-size:12px;white-space:pre;font-family:SFMono-Regular,Consolas,"Liberation Mono",Menlo,monospace"><span class="gmail-pl-smi" style="box-sizing:border-box;color:rgb(188,182,173)">Reason</span>   <span class="gmail-pl-k" style="box-sizing:border-box;color:rgb(255,115,105)">::</span> <span class="gmail-pl-en" style="box-sizing:border-box;color:rgb(197,143,255)">term</span>()</td></tr></tbody></table></div><div><br></div><div>Please let me know if there is any misconstrusion on my part. </div><div><br></div><div>Thanks and Regards</div><div>Nalin Ranjan</div><div><br></div><div><br></div><div><br></div><div></div><div><font color="#cdc8c2" face="SFMono-Regular, Consolas, Liberation Mono, Menlo, monospace" style="--darkreader-inline-color:#c5c0b8;"><span style="font-size:12px;white-space:pre;background-color:rgb(15,17,17)"></span></font></div></div>