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


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="jeramyRR" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/jeramyRR/120/722_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  jeramyRR
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="Nicd" data-post="29" 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/nicd/48/2357_2.png" class="avatar"> Nicd:</div>
<blockquote>
<p>Private functions do not have descriptions to display in programming tools when suggesting or looking up docs of a function, since they do not use the structured <code>@doc</code> that is used for that. It would be useful to see the description of a private function without scrolling.</p>
</blockquote>
</aside>
<p>This is another good point.  Tooling picks up the <a class="mention" href="/u/doc" rel="nofollow">@doc</a> tags for functions, but doesn’t for regular comments.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="110307" 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/32">Post #31</a>
	                </div>
	            </div>
              <div id="likers-container-110307" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="110307"
                     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 #31"></div>
  </section>
</div>
    <div class="postbit" id="110309" data-post-id="110309">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="jeramyRR" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/jeramyRR/120/722_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  jeramyRR
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Perhaps all of us are just looking at this the wrong way completely. Jose pointed out that the <a class="mention" href="/u/doc" rel="nofollow">@doc</a> attribute is like python’s docstrings.  It’s a quick way to get documentation printed out, and you can run a parser to find example strings for tests.  It is however lacking the power that the documentation/commenting systems of languages like Java and C# provide out of the box.</p>
<p>I tend to like strong, statically typed languages like Rust and C#, where a lot of what’s going on can be gleamed from the inputs to a function and it’s return type.  To get anything close to that I need to use Dialyzer.  Without Dialyzer I comment my functions more heavily than I would otherwise.  I still comment them while using Dialyzer, I just don’t have to add what’s expected to go into and out of the function.</p>
<p>Let’s take the function below for example:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defp build_url(%{ url_params: params }) do
...
end
</code></pre>
<p>From that I can gleam that I’m taking in a map or struct that has url_params as a field.  Yeah that’s great and simple, but really what I want devs coming after me to know is that we are using a Request struct in the pipeline.  I know, I know, the function doesn’t have to take in a specific type and that’s all we really need, but is that really enough?</p>
<p>I could define it the longer way:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defp build_url(request) do
  url_params = Map.get(request, :url_params)
...
end
</code></pre>
<p>No, that’s not right either.  What I really want to do is:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">@doc """
Description: Using the url_params field from a Request struct, we build ... blah
Consider: Note that this function may create a string that is not url friendly if
the params provided have any of the following characters: 
&lt; &gt; # % { } | \ ^ ~ [ ] `. 

To guarantee a url friendly string, filter the params through the 
filter_url_params function first. 

Example:
url_string = %Request{ url_params: [ "comp": "list", "max_items": 40 ] }
|&gt; filter_url_params
|&gt; build_url

Param: a Request struct
Return: A string that may or may not be url friendly.
"""
defp build_url(%{url_params: url_params}) do
...
end
</code></pre>
<p>I don’t need a nice pretty web page created from that, but it is really helpful when the tools like VS Code or Intellij pick it up.  They don’t/won’t do that with # comments.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="110309" 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/33">Post #32</a>
	                </div>
	            </div>
              <div id="likers-container-110309" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="110309"
                     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 #32"></div>
  </section>
</div>
    <div class="postbit" id="110312" data-post-id="110312">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="jeramyRR" data-post="33" 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>No, that’s not right either. What I really want to do is:</p>
</blockquote>
</aside>
<p>In that case, I would either surface it to the documentation of the parent function (the one that calls <code>build_url</code>), or move it to its own public function so I can properly document and test it.</p>
<p>For example, you could mention in the public function that any parameter containing <code>&lt; &gt; # % { } | \ ^ ~ [ ] </code> will be filtered out before building the URL. It may help you focus on the behaviour of the code instead of focusing on the implementation. But I can’t say for sure, I have only part of the context.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="110312" 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/35">Post #34</a>
	                </div>
	            </div>
              <div id="likers-container-110312" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="110312"
                     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 #34"></div>
  </section>
</div>
    <div class="postbit" id="110313" data-post-id="110313">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I’m sure this has probably been raised (and rejected) before but what might make commenting ‘easier’ and therefore as appealing as multi-line <code>@doc</code> blocks would be support for multi-line comments; something like <code>/#</code> and <code>#/</code> perhaps.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="110313" 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/36">Post #35</a>
	                </div>
	            </div>
              <div id="likers-container-110313" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="110313"
                     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 #35"></div>
  </section>
</div>
    <div class="postbit" id="110322" data-post-id="110322">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="jeramyRR" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/jeramyRR/120/722_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  jeramyRR
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Jose, what happens when the compiler encounters a <a class="mention" href="/u/doc" rel="nofollow">@doc</a> attribute on a private function?  Does it affect the compiler, or the results at all?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="110322" 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/37">Post #36</a>
	                </div>
	            </div>
              <div id="likers-container-110322" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="110322"
                     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 #36"></div>
  </section>
</div>
    <div class="postbit" id="110338" data-post-id="110338">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>The behaviour could be changed to discard <code>@doc</code> but I think allowing <code>@doc</code> in privates would open up a bunch of other problems. For example, if you try to write a doctest, it won’t work, because you can’t invoke a private function. Oh, do you want to access the <code>@doc</code> in your editor or terminal? That won’t work either, because private functions do not necessarily exist after the module is compiled, they can be inlined, transformed or even fully removed. Allowing <code>@doc</code> would indicate that those two constructs (public and private functions) are somewhat at the same level while they quite clearly aren’t.</p>
<p>All of this has already been said, so I will politely bow out of the discussion as I don’t have anything new to add here. <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="110338" data-batch-url="/posts/batch_likers">
                        12
                      </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/38">Post #37</a>
	                </div>
	            </div>
              <div id="likers-container-110338" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="110338"
                     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 #37"></div>
  </section>
</div>
    <div class="postbit" id="110377" data-post-id="110377">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I like <code>@doc</code>’s because it appears in my IDE when using a function call, comments do not (plus you can’t be sure what a ‘comment’ is attaching to unlike a <code>@doc</code>.  Even when using private functions that detail some complex algorithm and what this specific part is doing is amazingly useful.  I do <code>#</code> comment those currently but I get no intellisense about that where I would if it were <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="110377" data-batch-url="/posts/batch_likers">
                        6
                      </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/39">Post #38</a>
	                </div>
	            </div>
              <div id="likers-container-110377" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="110377"
                     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 #38"></div>
  </section>
</div>
    <div class="postbit" id="110384" data-post-id="110384">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I agree with the request for a multi line comment format.  I currently just keep the doc blocks for private functions and ignore the compiler warnings since I like the IDE color formatting and don’t like the looks of:</p>
<p>_ = “””<br>
Comment block<br>
“””</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="110384" 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/40">Post #39</a>
	                </div>
	            </div>
              <div id="likers-container-110384" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="110384"
                     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 #39"></div>
  </section>
</div>
    <div class="postbit" id="178244" data-post-id="178244">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I have done the same private documentation style, but feels inconsistent to me.</p>
<p>There will be no general agreed solution for this in the Elixir community. No language has everything that everybody wants, sorry!</p>
<p>Move on.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="178244" 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/41">Post #40</a>
	                </div>
	            </div>
              <div id="likers-container-178244" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="178244"
                     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 #40"></div>
  </section>
</div>
    <div class="postbit" id="213600" data-post-id="213600">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I’d love to see an <code>@docp</code> that supports the same syntax as <code>@doc</code> but does not generate documentation (or runs doc tests). An alternative could be to allow a way to allowlist the warnings that come up when a module attribute is unused.</p>
<p>Proper multiline comment support before function heads would be a workaround. My current approach is the one outlined <a href="https://stackoverflow.com/a/35389595/1481796" rel="noopener nofollow ugc">here</a>. The issue is the autoformatter adds a newline and function parenthesis.</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">comment("""
  Here is a multiline comment.
  Here is a multiline comment.
  """)

defp my_func()
</code></pre> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="213600" data-batch-url="/posts/batch_likers">
                        4
                      </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/42">Post #41</a>
	                </div>
	            </div>
              <div id="likers-container-213600" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="213600"
                     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 #41"></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=5">Load more posts (12 remaining)</a>
</div></template></turbo-stream>