<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="110240" data-post-id="110240">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Eiji" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Eiji/120/36743_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Eiji
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="mudasobwa" data-post="3" data-topic="19187">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/mudasobwa/48/5298_2.png" class="avatar"> mudasobwa:</div>
<blockquote>
<p>Sure thing. What you are missing is the main point: if there is a need to document a private function, it means there is a need for other developers to use this private function, which means it should not be private.</p>
</blockquote>
</aside>
<p>That’s totally correct, but only for small projects which have always same team members. Bigger projects could share pretty simple API and do most of work in private functions. Also I would see some public functions as half-private i.e. available only for current library/project - something like <code>dialyzer</code> check for internal functions. Look how big changes could happen in some bigger companies. It could be really helpful if there would be a way to document internal part of projects which should be dedicated for future team members. Look that we still can’t move our minds to robots, so sooner or later everyone is going to be replaced by someone else. Current way of defining documentation could help people understand how to use specific library/project - <strong>not</strong> how it’s intended to work internally and <strong>not</strong> how it should be maintained in future.</p>
<p>For sure we can use comments like <code># TODO: description</code> (of course really, really simple example) and create regular expressions in order to search for all places with such comment with shell commands like <code>grep</code>, but it’s not a solution which helps tooling <code>Elixir</code>. Libraries and projects like <code>ex_doc</code> can’t work directly on comments without extra tricks which are not needed for standard documentation. Such <code>tricks</code> does not allow to write simple tools enough quickly. Simply compare:</p>
<ol>
<li>depend on 3rd-party commands</li>
<li>write extra code</li>
<li>just fetch internal documentation by simple new switch in already existing API</li>
</ol>
<p>I recommend to read:<br>
<a href="https://forum.elixirforum.com/t/proposal-docp-for-private-function-documentation-and-doctests/3732" rel="nofollow">https://forum.elixirforum.com/t/proposal-docp-for-private-function-documentation-and-doctests/3732?u=eiji</a></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="110240" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/is-it-necessary-to-warn-about-the-doc-attribute-for-a-private-function/19187/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-110240" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="110240"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #11"></div>
  </section>
</div>
    <div class="postbit" id="110241" data-post-id="110241">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="sztosz" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/sztosz/120/1251_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  sztosz
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="mudasobwa" data-post="7" data-topic="19187">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/mudasobwa/48/5298_2.png" class="avatar"> mudasobwa:</div>
<blockquote>
<p>That is where you got it wrong. The way for that was chosen (by language creator.) This way is (like it, or hate it, it does not actually matter): you use <code>@doc</code> to comment public functions only, period.</p>
</blockquote>
</aside>
<p><img src="https://forum.elixirforum.com/images/emoji/apple/joy.png?v=15" title=":joy:" class="emoji only-emoji" alt=":joy:" loading="lazy" width="20" height="20"></p>
<p>And Jose and other people from core team ask community about thing they want to implement for sheer amusement. I don’t know Jose personally, but I will bet my arm, that he really cares about what people think about Elixir and read constructive criticism. More often than not he also acts upon it. Either by explaining why some things can’t be changed (easily), or by simple changing things. The way it is, You are wrong, period.</p>
<aside class="quote no-group" data-username="mudasobwa" data-post="8" data-topic="19187">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/mudasobwa/48/5298_2.png" class="avatar"> mudasobwa:</div>
<blockquote>
<p>There is nothing more overhyped for zero value than strong typing. It brings literally nothing save for headaches and enormously huge boilerplates.</p>
</blockquote>
</aside>
<p>I’ve seen no study that was conducted in a good scientific manner, not biased, that proved your opinion. I have written in Python, Ruby, Elixir, and Rust, but also some JS, Java and C, C++. From my experience you have to write much more boilerplate code in dynamic languages. And by boilerplate I mean lots of tests that tests things that normally are guaranteed by compiler in statically typed languages. And in those dynamically to be honest I’ve seen lot of bugs in production environments that was due to wrong types of data being passed around, that could be avoided with static typing.</p>
<p>PS. Elixir is rather strongly typed language, same as Erlang, it’s just not statically typed. And let’s save ourselves discussion about how truly strong typed language should behave.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="110241" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/is-it-necessary-to-warn-about-the-doc-attribute-for-a-private-function/19187/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-110241" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="110241"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #12"></div>
  </section>
</div>
    <div class="postbit" id="110242" data-post-id="110242">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="mudasobwa" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/mudasobwa/120/5298_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  mudasobwa
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Cure</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group quote-modified" data-username="jeramyRR" data-post="10" data-topic="19187">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/jeramyrr/48/722_2.png" class="avatar"> jeramyRR:</div>
<blockquote>
<p>[…] you already went against it when you suggested that commenting be replaced by using dialyzer […]</p>
</blockquote>
</aside>
<p>FYI: I never ever <em>suggested</em> anything like that, neither in this topic nor anywhere else.</p>
<p>I believe, reading and understanding what people reply is the significant part of any discussion.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="110242" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/is-it-necessary-to-warn-about-the-doc-attribute-for-a-private-function/19187/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-110242" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="110242"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #13"></div>
  </section>
</div>
    <div class="postbit" id="110244" data-post-id="110244">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Eiji" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Eiji/120/36743_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Eiji
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="sztosz" data-post="13" data-topic="19187">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/sztosz/48/1251_2.png" class="avatar"> sztosz:</div>
<blockquote>
<p>From my experience you have to write much more boilerplate code in dynamic languages. And by boilerplate I mean lots of tests that tests things that normally are guaranteed by compiler in statically typed languages. And in those dynamically to be honest I’ve seen lot of bugs in production environments that was due to wrong types of data being passed around, that could be avoided with static typing.</p>
</blockquote>
</aside>
<p>How about <code>dialyzer</code>? If I remember correctly it have checks for that.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="110244" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/is-it-necessary-to-warn-about-the-doc-attribute-for-a-private-function/19187/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-110244" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="110244"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #14"></div>
  </section>
</div>
    <div class="postbit" id="110245" data-post-id="110245">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="mudasobwa" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/mudasobwa/120/5298_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  mudasobwa
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Cure</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="Eiji" data-post="12" data-topic="19187">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/eiji/48/36743_2.png" class="avatar"> Eiji:</div>
<blockquote>
<p>That’s totally correct, but only for small projects which have always same team members.</p>
</blockquote>
</aside>
<p>I tend to disagree; I am aware about <code>@docp</code> and family proposals. I am positive that documenting privates for the sake of having them documented does not solve the aforementioned issue.</p>
<p>No one single private function is documented in Elixir core and it still reads as a charm. The same works for <em>Ecto</em>. I believe (I did not check it carefully though) <em>Phoenix</em> is the member of that team as well.</p>
<p>Good design, encapsulation, SRP and common sense make the code readable without redundant docs. And as soon as the project is so complicated that it requires a documentation for developers (I could think of some math algorithms, or even ML,) the <em>infrastructure to document it</em> is worth to be built from the scratch <em>with the needs of this particular project in mind</em>.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="110245" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/is-it-necessary-to-warn-about-the-doc-attribute-for-a-private-function/19187/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-110245" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="110245"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #15"></div>
  </section>
</div>
    <div class="postbit" id="110247" data-post-id="110247">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="benperiton" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/benperiton/120/1572_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  benperiton
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I don’t think that a team wanting to keep their private functions documented - maybe with a link to an internal wiki page, or explanation as to why something is done how it is etc - is a bad thing.</p>
<p>It helps junior developers when learning, it helps when memory fades and you can’t remember why something was done a particular way etc</p>
<p>Adding a way to document private functions doesn’t affect anyone not wanting to use it in anyway, but  helps out those that do want to use it greatly</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="110247" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/is-it-necessary-to-warn-about-the-doc-attribute-for-a-private-function/19187/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-110247" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="110247"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #16"></div>
  </section>
</div>
    <div class="postbit" id="110248" data-post-id="110248">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="sztosz" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/sztosz/120/1251_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  sztosz
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Dialyzed is great, but it’s spec are not part of the actuall implementation. You can have perfectly valid code and dialyzed warnings because of wrong types (lot of libraries have wrong dialyzed types, or at least incomplete ones). Or you can have bugs in code, but no dialyzer warnings because of, again, wrong specs.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="110248" data-batch-url="/posts/batch_likers">
                        0
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/is-it-necessary-to-warn-about-the-doc-attribute-for-a-private-function/19187/18">Post #17</a>
	                </div>
	            </div>
              <div id="likers-container-110248" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="110248"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #17"></div>
  </section>
</div>
    <div class="postbit" id="110249" data-post-id="110249">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="mudasobwa" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/mudasobwa/120/5298_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  mudasobwa
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Cure</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group quote-modified" data-username="benperiton" data-post="17" data-topic="19187">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/benperiton/48/1572_2.png" class="avatar"> benperiton:</div>
<blockquote>
<p>Adding a way to document private functions doesn’t affect anyone not wanting to use it in anyway […]</p>
</blockquote>
</aside>
<p>That is true, but also it implicitly makes the developers to think less about what is to be made private and why. Also, it obsoletes the documentation or implies the redundant changes when the implementation details are changed.</p>
<p>The same reason drives an unwillingness to make private functions testable.</p>
<p>Implementation details should not leak in any way, even if it sounded as a good intention at a glance.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="110249" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/is-it-necessary-to-warn-about-the-doc-attribute-for-a-private-function/19187/19">Post #18</a>
	                </div>
	            </div>
              <div id="likers-container-110249" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="110249"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #18"></div>
  </section>
</div>
    <div class="postbit" id="110251" data-post-id="110251">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Eiji" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/Eiji/120/36743_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Eiji
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="mudasobwa" data-post="16" data-topic="19187">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/mudasobwa/48/5298_2.png" class="avatar"> mudasobwa:</div>
<blockquote>
<p>No one single private function is documented in Elixir core and it still reads as a charm. The same works for <em>Ecto</em> . I believe (I did not check it carefully though) <em>Phoenix</em> is the member of that team as well.</p>
</blockquote>
</aside>
<p>oh, looks like that I’m much bigger noob than I originally expected <img src="https://forum.elixirforum.com/uploads/default/original/2X/2/20c9c52366de24191270f0b11311379ce60ac82d.gif?v=15" title=":077:" class="emoji emoji-custom" alt=":077:" loading="lazy" width="20" height="20"></p>
<p>For example one time I have entered random file in <code>ecto</code> repository and totally did not get most of things written there (working on <code>Elixir</code> AST). After some time I started to understand more, but to do it I have going through docs like compiler - from start of public call to last private function. I’m able to find old discussion which describes why they follows such way etc., but I still need to spend some time on it rather than just read directly. I don’t believe that every beginner would understand any random private function especially from <code>Elixir</code> core which is partially written in <code>Erlang</code>.</p>
<p>btw. I think that you are a bit wrong. For example take a look at: <code>ecto/lib/ecto/query/builder/select.ex</code> and look that <code>Ecto.Query.Builder.Select</code> module is considered to be fully private (<code>@moduledoc false</code>), but there is still written documentation for <code>Ecto.Query.Builder.Select.escape/3</code> function. It’s internal function, but it’s also still documented. It should never be shown in <code>ex_doc</code>, but for some reason it’s still documented.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="110251" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/is-it-necessary-to-warn-about-the-doc-attribute-for-a-private-function/19187/20">Post #19</a>
	                </div>
	            </div>
              <div id="likers-container-110251" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="110251"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #19"></div>
  </section>
</div>
    <div class="postbit" id="110252" data-post-id="110252">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="wojtekmach" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/wojtekmach/120/999_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  wojtekmach
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Hex Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>TL;DR:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule Mod do
  @doc """
  Public docs
  """
  def public, do: ...

  # Private docs
  defp private, do: ...
end
</code></pre>
<p>that’s it!</p>
<p>While we can’t use <code>@doc</code> for documenting private functions, nothing stops us for using comments to document them. Similarly, if a module is meant to be private we’d mark it as <code>@moduledoc false</code> and document it by using comments. There are many such examples in Elixir itself and libraries.</p>
<p>I don’t think it’s fair to say that documenting internals is discouraged, it’s just we can’t use mechanisms like <code>@doc</code> and <code>@moduledoc</code> for it. <code>@doc</code> etc is used by the compiler to put documentation into beam chunks so that it can be later used by tooling like IEx, ExDoc etc to display public docs. Since private functions are, well, private, tools like IEx and ExDoc won’t seen them so it doesn’t make sense to use <code>@doc</code> etc for them. In fact the compiler could even inline private functions as an optimisation. We could special-case <code>@doc</code> not to put anything into beam chunk if it sees a private function, but that seems like needless complexity. Even if <code>@doc</code> wouldn’t warn, since the tooling won’t show private docs, the only way to see them is to look at the source code. And at the source code, is it really a big deal to use a code comment over a <code>@doc</code>?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="110252" data-batch-url="/posts/batch_likers">
                        11
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/is-it-necessary-to-warn-about-the-doc-attribute-for-a-private-function/19187/21">Post #20</a>
	                </div>
	            </div>
              <div id="likers-container-110252" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="110252"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #20"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <a class="load-more-button" data-turbo-stream="true" href="/topics/19187/load_more?page=3">Load more posts (32 remaining)</a>
</div></template></turbo-stream>