<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="92088" data-post-id="92088">
  <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">
								<p>It’s already possible to include dynamic content in documentation, but it’s a bit tricky to do that since you need to ensure that whatever code you’re using is already loaded. This could get even more complicated in Elixir core because of bootstrapping, but correct me <a class="mention" href="/u/josevalim" rel="nofollow">@josevalim</a>, if I’m wrong.</p>
<p>Here’s an example:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule DocHelpers do
  def list_guards do
    ~w(is_atom/1 is_binary/1 length/1)
  end
end

defmodule DynDoc do
  @doc """
  Guards

  Not all expressions are allowed in guard clauses.

  List of allowed expressions:

  #{Enum.map_join(DocHelpers.list_guards(), "\n", &amp;"  * #{&amp;1}")}
  """
  def guards, do: @doc
end
</code></pre>
<p>and the output:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">iex(5)&gt; h DynDoc.guards

                                  def guards()

Guards

Not all expressions are allowed in guard clauses.

List of allowed expressions:

  • is_atom/1
  • is_binary/1
  • length/1
</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="92088" 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/45">Post #44</a>
	                </div>
	            </div>
              <div id="likers-container-92088" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="92088"
                     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 #44"></div>
  </section>
</div>
    <div class="postbit" id="92090" data-post-id="92090">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="yurko" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/yurko/120/2369_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  yurko
                  </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>In some cases, however, to keep those messages as clear as possible, they end-up spanning multiple lines</p>
</blockquote>
</aside>
<p>I kind of got used to them <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"> Also the really long ones are shown only in cases when something is clearly wrong so they don’t show up that often. I see the point in shortening them to be able to show more info for more basic errors though, so <img src="https://forum.elixirforum.com/images/emoji/apple/+1.png?v=15" title=":+1:" class="emoji" alt=":+1:" loading="lazy" width="20" height="20"> to the proposed changes.</p>
<aside class="quote no-group" data-username="OvermindDL1" data-post="25" 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/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>Just as a note, I love this! Never let warnings be disableable! <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>+1 this is really good</p> 
	            </div>

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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p><span class="hashtag-raw">#1</span></p>
<p>I’m with <a class="mention" href="/u/overminddl1" rel="nofollow">@OvermindDL1</a> on this one <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>
<aside class="quote no-group" data-username="OvermindDL1" data-post="25" 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/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>Overall though, I like the verbose warnings. It is both telling you what is wrong and often how to fix it, but also is a big thing of “You Need To Stop Doing This Warning Thing”.</p>
</blockquote>
</aside>
<p>I would also be nice to have a list of which warnings would be affected by this change, and how often long warnings appear in Elixir packages.</p>
<p>To be honest, I haven’t had that impression of “scary long warnings”.</p>
<p><span class="hashtag-raw">#2</span></p>
<p>The first thing that caught my eye was how close the proposed syntax is to <a href="https://github.com/elixir-lang/elixir/blob/master/lib/elixir/src/elixir.erl#L120-L121" rel="noopener nofollow ugc">function calls in Erlang</a> (i.e. <code>os:system_time()</code>). It’s just an anecdote, but it might be confusing for developers coming from that programming language.</p>
<p>As others has expressed, my main concern is how developers are going to provide this detailed explanations in their codebases.</p>
<p>Besides, this seems to be defined at application/project level. So, the best place would be the <code>mix.exs</code> file? I actually don’t think that should be the place, but what other alternatives there are? Aggregate the warning information of each module?</p>
<p><span class="hashtag-raw">#3</span></p>
<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>In particular, I propose to support all of <code>--help</code> , <code>--type-help</code> , <code>--behaviour-help</code> and <code>--open</code> in the <code>elixir</code> command line. I think being able to do <code>elixir --open String</code> and have the module open in my editor would be fantastic.</p>
</blockquote>
</aside>
<p>I would expect <code>--help</code> to be the help of the <code>elixir</code> command, not related to documentation nor IEx helpers.</p>
<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>One reason to say yes is completeness. However, I personally open IEx multiple times only to retrieve the documentation or to open a module, so I would definitely use this feature too.</p>
</blockquote>
</aside>
<p>In addition, Elixir provides all the tools to build your own shortcuts for that:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">elixir -e "require IEx.Helpers; IEx.Helpers.h Map"
</code></pre>
<p>You can define your own scripts based on that, for example <code>iexh</code>, <code>iexb</code> and <code>iext</code> (which will be shorter than their <code>elixir --help</code>, <code>elixir --behaviour-help</code>, and <code>elixir --type-help</code> counterparts):</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">#!/bin/sh

# Usage: iexh Map
elixir -e "require IEx.Helpers; IEx.Helpers.h $1"

# Usage: iexb GenServer
elixir -e "require IEx.Helpers; IEx.Helpers.b $1"

# Usage: iext Calendar.iso_days
elixir -e "require IEx.Helpers; IEx.Helpers.t $1"
</code></pre>
<p><strong>Edit:</strong> I think the commands above won’t work with external packages <img src="https://forum.elixirforum.com/images/emoji/apple/sweat_smile.png?v=15" title=":sweat_smile:" class="emoji" alt=":sweat_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="92095" 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/47">Post #46</a>
	                </div>
	            </div>
              <div id="likers-container-92095" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="92095"
                     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 #46"></div>
  </section>
</div>
    <div class="postbit" id="92098" data-post-id="92098">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="fertapric" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/fertapric/120/29393_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  fertapric
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Elixir Core Team</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="44" 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>
<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>
</blockquote>
</aside>
<p>I think those are runtime errors.</p>
<p>However, this comment opens a new question: would the help catalog be restricted to warnings, or exceptions/errors or any kind of hint would be permitted?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="92098" 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/48">Post #47</a>
	                </div>
	            </div>
              <div id="likers-container-92098" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="92098"
                     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 #47"></div>
  </section>
</div>
    <div class="postbit" id="92100" data-post-id="92100">
  <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 no-group" data-username="lackac" data-post="45" 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’s already possible to include dynamic content in documentation, but it’s a bit tricky to do that since you need to ensure that whatever code you’re using is already loaded. This could get even more complicated in Elixir core because of bootstrapping, but correct me <a class="mention" href="/u/josevalim" rel="nofollow">@josevalim</a>, if I’m wrong.</p>
</blockquote>
</aside>
<p>Yeah, but that is executing on compilation time, by assigning a function to <code>@doc</code> this function would execute on runtime.</p> 
	            </div>

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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote group-livebook_core_team quote-modified" 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>
<blockquote>
<h3>Long warnings should be opt out, not opt elsewhere</h3>
</blockquote>
<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>
</blockquote>
</aside>
<p>I’d like to add another vote for this. I think that moving to “short” messages by default will be harmful for new developers.</p>
<p>Take this warning from the original post:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">warning: def foo/2 has multiple clauses and also declares default values. In such cases, the default values should be defined in a header. Instead of:

    def foo(:first_clause, b \\ :default) do ... end
    def foo(:second_clause, b) do ... end

one should write:

    def foo(a, b \\ :default)
    def foo(:first_clause, b) do ... end
    def foo(:second_clause, b) do ... end

  iex:4
</code></pre>
<p>If that was shorted to <code>warning: def foo/2 has multiple clauses and also declares default values. Please define default values in a header (elixir --explain defaults_and_clauses)</code> by default it is <strong>much</strong> less helpful (and friendly!) for someone just starting with Elixir. I know it’s more work but I’d prefer to have short, medium, and long versions of warnings. The short version would basically just be a title, in this case perhaps: <code>def foo/2 has multiple clauses and also declares default values. Please define default values in a header</code>.</p>
<p>Then the medium version (which is by default printed out for compilation warnings) would start with the exact same title and follow it up with the expanded information that we currently have now. And the long version would build upon that with yet more information, sometimes it would just append information to the medium version, but it could also optionally re-write the medium version completely (but keep the same title).</p>
<aside class="quote group-livebook_core_team quote-modified" 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>
<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>
<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>I want to note that using short warnings by default also makes it more difficult to access the expanded information depending on way that you are viewing the error. For example if the error is in your test output on CI you actually be on a computer where you cannot just easily run <code>elixir --help cmd</code>. This is another reason it would be nice if the detailed warning information was available online.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="92132" 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/50">Post #49</a>
	                </div>
	            </div>
              <div id="likers-container-92132" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="92132"
                     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 #49"></div>
  </section>
</div>
    <div class="postbit" id="92156" data-post-id="92156">
  <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">
								<p>Thanks everyone for the feedback.</p>
<p>I will archive this proposal for now. It seems that the majority of developers prefer the long warnings and, if short warnings will be opt-in, it will likely be used only by a few and therefore I do not see the benefits of adding this complexity to the tool chain.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="92156" data-batch-url="/posts/batch_likers">
                        13
                      </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/51">Post #50</a>
	                </div>
	            </div>
              <div id="likers-container-92156" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="92156"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>