<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="92042" data-post-id="92042">
  <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 group-livebook_core_team" data-username="josevalim" data-post="19" data-topic="15718">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/48/1787_2.png" class="avatar"> josevalim:</div>
<blockquote>
<p><strong>The help catalog is useful to store complementary and non-contextual information about warnings and errors. All contextual information should remain as part of the warning/error</strong> .</p>
</blockquote>
</aside>
<p>Hey, not really a proposition, but just something comes to my mind. Imagine something like cache enhancement for help catalogs. Such cache could store type, app and context-based data. It could be even disabled by default and cached data would change when project is recompiling. Then we could have two ways to cache:</p>
<ol>
<li>
<p>automatic (default if caching enabled) - instead of focusing on specific named warning we could just browse them separately one after another</p>
</li>
<li>
<p>manual - display short warning and ask to cache it every time<br>
If enabled developer could name specified cache, so it could be fetched easily</p>
</li>
</ol>
<p>I don’t even know if that requires lots of work or no. Just it’s what my crazy brain visualized. <img src="https://forum.elixirforum.com/images/emoji/apple/smiley.png?v=15" title=":smiley:" class="emoji" alt=":smiley:" 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="92042" 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/proposal-introduce-help-catalogs/15718/35">Post #34</a>
	                </div>
	            </div>
              <div id="likers-container-92042" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="92042"
                     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="92049" data-post-id="92049">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="1" data-topic="15718">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/48/1787_2.png" class="avatar"> josevalim:</div>
<blockquote>
<p><strong>Question 1:</strong> what do think about the idea of supporting help catalog in general? (regardless of the command structure, syntax, etc)</p>
</blockquote>
</aside>
<p>I’d like a help catalog, but <strong>I do not think it would be helpful to new developers</strong>. I gained an understanding of Elixir partly because the warnings were clear and obvious and sometimes verbose. It can be a frustrating experience to get a bunch of brief errors and <em>then</em> have to refer to another source of information. It can also be exhausting and make a developer want to give up. This is part of the friction I got when starting with Erlang – the errors were often too brief and hard to interpret.</p>
<p>Instead, I think</p>
<h3><a name="p-92049-long-warnings-should-be-opt-out-not-opt-elsewhere-1" class="anchor" href="#p-92049-long-warnings-should-be-opt-out-not-opt-elsewhere-1" aria-label="Heading link" rel="nofollow"></a>Long warnings should be opt out, not opt elsewhere</h3>
<p>The long warning should be opt out. Seasoned developers can put the relevant config options in mix.exs. Or something like <code>elixirc --brief-warnings</code>. I do like the idea of this proposal, but I also know that there is a scare factor for <em>new</em> developers seeing a warning like:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">warning: def foo/2 has multiple clauses and also declares default values (elixir --explain default_values)
</code></pre>
<p>Then running that command and seeing a whole page of details about function heads, but not seeing it in context. This can be really exhausting to have to switch between the compiler output and then referring to another source of information.</p>
<h3><a name="p-92049-in-general-yes-to-help-catalogs-2" class="anchor" href="#p-92049-in-general-yes-to-help-catalogs-2" aria-label="Heading link" rel="nofollow"></a>In general, yes to help catalogs</h3>
<p>Yes to help catalogs, but with the caveat that the long warnings are there by default and can be shortened with an option like <code>--brief-warnings</code>.</p>
<p>The syntax and formats proposed are reasonable to me.</p>
<p>Another problem is having to write two different versions of the warning, but that would happen with my suggestion and with the catalog.</p> 
	            </div>

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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="33" data-topic="15718">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/48/1787_2.png" class="avatar"> josevalim:</div>
<blockquote>
<p>I have mentioned on other replies why I don’t think moving this to the documentation is a good idea, so please check them and follow back. But in a nutshell, there is more dynamic information than just the context of the warning.</p>
</blockquote>
</aside>
<p>I see. Sorry for repeating it then, but I still think help catalogs is just one more thing to learn for newcomers. Why not dynamic docs in the following style:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">@doc &amp;guards_doc/0
def guards(left, right), do: ...

defp guards_doc() do
  # Here you extract the guards doc
end 
</code></pre>
<p>That would even make something like this possible:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule Math do
  @doc &amp;add_doc/1
  def add(left, right), do: ...

  defp add_doc(nil), do: "Adds `left` to `right`."
  defp add_doc([left, right]), do: "Adds `#{left}` to `#{right}`."
end

h Math.add
=&gt;                               def add(left, right)
=&gt;
=&gt; Adds `left` to `right`.

h Math.add(1, 2)
=&gt;                               add(1, 2)
=&gt;
=&gt; Adds `1` to `2`.
</code></pre>
<p>Any thoughts?</p> 
	            </div>

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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>A good example of it’s use would be:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule Math do
  @doc &amp;div_doc/1
  def div(left, right), do: left / right

  defp div_doc([_, 0]), do: "It's mathematically impossible to divide any number by `0`"
  defp div_doc(_), do: "Divides `left` by `right`"
end
</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="92058" 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/proposal-introduce-help-catalogs/15718/38">Post #37</a>
	                </div>
	            </div>
              <div id="likers-container-92058" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="92058"
                     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="92061" data-post-id="92061">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Anyways, I see how my proposal it’s kind of deviating from the original solution, but I’m just trying to think a suitable solution for the same problem without having to add a new entity like “catalogs” to the table. So please, critics are really welcome, maybe I’m not thinking in the problems my solutions might cause, or maybe there is something I’m missing…</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="92061" 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/proposal-introduce-help-catalogs/15718/39">Post #38</a>
	                </div>
	            </div>
              <div id="likers-container-92061" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="92061"
                     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="92070" data-post-id="92070">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="33" data-topic="15718">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/48/1787_2.png" class="avatar"> josevalim:</div>
<blockquote>
<p>We need to balance the confusion of also using <code>help</code> for catalog with the confusion of introducing a third option. Today we already have two commands: <code>help</code> and <code>info</code> . I don’t know the correct answer, but I have a <em>feeling</em> introducing a third command will just be too confusing.</p>
</blockquote>
</aside>
<p>Is there any way to test this? Do you have knowledge of how other compilers approach this topic? If I recall, Rust was mentioned on IRC as a good example, but I don’t think they provide documentation access from CLI.</p>
<p>My <em>feeling</em> is that presenting the command in the warning message where you can just copy-paste from makes it very friendly to newcomers regardless of the name of the option.</p>
<p>On the other hand, I understand that you are trying to limit the number of options people need to learn to be productive with the CLI and IEx. However, we already have <code>h</code>, <code>b</code>, <code>t</code>, and <code>i</code> in IEx instead of a single <code>help</code> that covers all. To that end, would it be worth considering unifying them? I realise they are separate because of the ambiguity of <code>h Module.something</code>. Are you interested in a function? Callback? Type? Do you want information on the return value of <code>Module.something()</code>? If we remove <code>i</code> from the equation we could handle all of those cases intelligently. <code>h</code> could query all of functions, callbacks and types and list all of them. With the same syntax as in docs the result could be more focused (<code>h c:GenServer.handle_call</code>). There are some unanswered questions here, like how to list callbacks and types, but since this is starting to get off topic I’m going to stop here. <a class="mention" href="/u/josevalim" rel="nofollow">@josevalim</a>, feel free to move this bit to a new thread if you think it’s worth considering.</p>
<p>Going back to the question of the catalog. If we unify <code>h</code>, <code>b</code>, and <code>t</code>, then I think it makes sense to pull the catalog functionality under the same roof too. Otherwise I’d follow the same pattern as with those helpers and differentiate on the command level instead of the argument level.</p> 
	            </div>

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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="lackac" data-post="30" data-topic="15718">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/lackac/48/6584_2.png" class="avatar"> lackac:</div>
<blockquote>
<p>It seems though that the docs chunk approach would prevent dynamic content. Isn’t there a way to have the best of both worlds? I have a half baked solution in mind, but will sleep on it before I write it up.</p>
</blockquote>
</aside>
<p>There have been two examples mentioned as the purpose of dynamic content:</p>
<ol>
<li>For including contextual information</li>
</ol>
<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="20" data-topic="15718">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/48/1787_2.png" class="avatar"> josevalim:</div>
<blockquote>
<p>For example, Phoenix could look into the user configuration and say “you can change this behaviour by setting X, it is currently set to false”.</p>
</blockquote>
</aside>
<ol start="2">
<li>For simply generating otherwise static information</li>
</ol>
<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="20" data-topic="15718">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/48/1787_2.png" class="avatar"> josevalim:</div>
<blockquote>
<p>In Elixir, for example, I would like for <code>elixir:guards</code> to show all guards</p>
</blockquote>
</aside>
<p>Those are both useful when invoking the catalog from the command line. As part of documentation generated by ExDoc the dynamic part of the information becomes less useful. In the first case it’s because the referenced configuration value could be out of date. In the second the listing could be replaced by a link to the relevant page in the docs.</p>
<p>In order to get the best of both worlds I think we can follow <a class="mention" href="/u/josevalim" rel="nofollow">@josevalim</a>’s implementation proposal of using functions, but introduce the convention of using the function’s docs for the static parts:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule HelpCatalog do
  @doc """
  Guard functions

  Not all expressions are allowed in guard clauses, but only a handful of them. This is a deliberate choice. This way, Elixir (and Erlang) can make sure that nothing bad happens while executing guards and no mutations happen anywhere. It also allows the compiler to optimize the code related to guards efficiently.

  Visit [Guards guide](/guards.html) to learn more.
  """
  def guards do
    all_guards =
      fetch_all_guards_from_docs()
      |&gt; Enum.map_join("\n", &amp;"  * #{&amp;1}")
    @doc &lt;&gt; "\n#{all_guards}"
  end
end
</code></pre>
<p>This way there is no extra work to make this part of ExDoc generated content, and the static parts even become part of the docs chunk. Another added benefit is that it becomes easier to maintain the content as it’s syntax highlighted as markdown by the editor. <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="92076" 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/proposal-introduce-help-catalogs/15718/41">Post #40</a>
	                </div>
	            </div>
              <div id="likers-container-92076" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="92076"
                     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="92079" data-post-id="92079">
  <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
                    <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 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="voughtdq" data-post="36" data-topic="15718">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/voughtdq/48/9633_2.png" class="avatar"> voughtdq:</div>
<blockquote>
<h3>Long warnings should be opt out, not opt elsewhere</h3>
</blockquote>
</aside>
<p>Thanks for the input <a class="mention" href="/u/voughtdq" rel="nofollow">@voughtdq</a>. It is really nice to hear that Elixir warnings have been helpful. I have explained in previous replies why long warnings should need to be opt-in. Can you please see the previous comments and reply accordingly? In a nutshell, once the catalog is present, the warnings will tend to get much longer.</p>
<aside class="quote no-group" data-username="kelvinst" data-post="37" data-topic="15718">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/kelvinst/48/10173_2.png" class="avatar"> kelvinst:</div>
<blockquote>
<p>I see. Sorry for repeating it then, but I still think help catalogs is just one more thing to learn for newcomers.</p>
</blockquote>
</aside>
<p>How is it one more thing to learn? The only time they will have to care about it, we will explicitly tell them which command to run. It is not like they have to memorize it. <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>
<p>In your example, such as <code>div_doc</code>, when would <code>div_doc</code> ever be called with zero? What is passing those inputs in? How would ExDoc know how to generate documentation from now on?</p>
<aside class="quote no-group" data-username="lackac" data-post="40" data-topic="15718">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/lackac/48/6584_2.png" class="avatar"> lackac:</div>
<blockquote>
<p>To that end, would it be worth considering unifying them? I realise they are separate because of the ambiguity of <code>h Module.something</code> . Are you interested in a function? Callback? Type? Do you want information on the return value of <code>Module.something()</code> ?</p>
</blockquote>
</aside>
<p>I would say that unifying them is welcome. We recently got rid of <code>s</code> exactly because of this. But, as you said, I don’t know how to do it without adding ambiguity. Note that the arguments of <code>h</code> have to be valid Elixir syntax and <code>c:GenServer</code> isn’t (it is, but it emits warnings).</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="92079" 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/proposal-introduce-help-catalogs/15718/42">Post #41</a>
	                </div>
	            </div>
              <div id="likers-container-92079" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="92079"
                     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>
    <div class="postbit" id="92083" data-post-id="92083">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="42" data-topic="15718">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/48/1787_2.png" class="avatar"> josevalim:</div>
<blockquote>
<p>How is it one more thing to learn? The only time they will have to care about it, we will explicitly tell them which command to run. It is not like they have to memorize it. <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>
</blockquote>
</aside>
<p>Well, still one more thing. I mean, not a big thing, and as you mentioned, it’s not something you really have to learn since it guides you to use it when needed, but my point is: why having this “one more thing” if we could make what we already have (the docs) dynamic to solve the problem?</p>
<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="42" data-topic="15718">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/48/1787_2.png" class="avatar"> josevalim:</div>
<blockquote>
<p>In your example, such as <code>div_doc</code> , when would <code>div_doc</code> ever be called with zero? What is passing those inputs in? How would ExDoc know how to generate documentation from now on?</p>
</blockquote>
</aside>
<p>Sorry if it was not clear. The function accepted in my example would either be a 0 or 1 arity function, and for 1-arity function it would receive the values of arguments. This could be used to make <code>h Math.div(1, 0)</code> print out some help about division by zero.</p>
<p>I mean, I know it may not be used that much, but still, it’s an improvement to the docs that makes it possible to do what you want for guards. Also, I know it creates problems to generate the online docs, since there will be multiple versions of it for the same function, but we could define that this 1-arity functions should always match to <code>nil</code> and print the details for all cases there, and send <code>nil</code> as this function when generating the online docs or when doing <code>h Math.div</code>.</p>
<p>Something like this:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule Math do
  @doc &amp;div_doc/1
  def div(left, right), do: left / right

  defp div_doc([_, 0]), do: "It's mathematically impossible to divide any number by `0`"
  defp div_doc(nil) do 
    """
    Divides `left` by `right`

    ## Observations

    - `right` should not be `0`: #{div_doc([nil, 0])}
    """
  end
end
</code></pre>
<p>EDIT: I know the example I created is not <strong>very</strong> good use case for this 1-arity function, and I really can’t think on a good one for it right now. So maybe only supporting 0-arity functions would be good enough, since it already covers everything you would be able to do with help catalogs, and we could leave the <code>h Math.div(x, y)</code> idea for another time. <img src="https://forum.elixirforum.com/images/emoji/apple/wink.png?v=15" title=":wink:" class="emoji" alt=":wink:" 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="92083" 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/proposal-introduce-help-catalogs/15718/43">Post #42</a>
	                </div>
	            </div>
              <div id="likers-container-92083" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="92083"
                     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 #42"></div>
  </section>
</div>
    <div class="postbit" id="92086" data-post-id="92086">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="42" data-topic="15718">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/48/1787_2.png" class="avatar"> josevalim:</div>
<blockquote>
<p>In a nutshell, once the catalog is present, the warnings will tend to get much longer.</p>
</blockquote>
</aside>
<p>I understand what you mean now - it would be repetition of the same big warning.</p>
<p><a href="https://github.com/elixir-ecto/ecto/blob/v2.2.10/lib/ecto/changeset/relation.ex#L200-L226" rel="noopener nofollow ugc">These ecto errors</a> are the errors I imagine would be moved to the help catalog. I’d prefer to have them directly in the compilation result, but I guess it poses a problem when they keep appearing over and over.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="92086" 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/proposal-introduce-help-catalogs/15718/44">Post #43</a>
	                </div>
	            </div>
              <div id="likers-container-92086" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="92086"
                     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 #43"></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/15718/load_more?page=5">Load more posts (7 remaining)</a>
</div></template></turbo-stream>