<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="255031" data-post-id="255031">
  <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 no-group" data-username="ityonemo" data-post="11" data-topic="48752">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/ityonemo/48/11341_2.png" class="avatar"> ityonemo:</div>
<blockquote>
<p>Ok. I still count three declarations. Shrug.</p>
</blockquote>
</aside>
<p>Yes, in a strict code sense, it’s three declarations, but we’re talking about someone else reading the code. So the outer module is like a document body, and the inner module is like a paragraph.</p>
<aside class="quote no-group" data-username="ityonemo" data-post="11" data-topic="48752">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/ityonemo/48/11341_2.png" class="avatar"> ityonemo:</div>
<blockquote>
<p>The aliasing rules are also implicit and not entirely obvious (the state module becomes MyModule.State and is implicitly aliased as State, but only in the scope of MyModule). Already OP in this thread has made that mistake…</p>
</blockquote>
</aside>
<p>This convention is targeted toward the reader of the code, so if they’re working in the module, they will already know to use <code>%State{}</code>. The idea is that the reader should be able to search for State in the code and have a single place to look to find out what it is.</p>
<aside class="quote no-group" data-username="ityonemo" data-post="11" data-topic="48752">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/ityonemo/48/11341_2.png" class="avatar"> ityonemo:</div>
<blockquote>
<p>This is compile-time checked by elixir.</p>
</blockquote>
</aside>
<p>This is only true for functions:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule TestModule do
  defstruct [:test]

  @type x :: integer()
  @type y :: integer()
  @type z :: integer()
  @type a :: integer()
  @type n :: integer()
  @type m :: integer()
  @type o :: integer()

  @spec hello_world :: :ok
  def hello_world do
    :ok
  end

  @type t :: %__MODULE__{test: nil | :test}
end
</code></pre>
<p>This will not raise any errors in v1.13.3</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="255031" 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/how-do-you-work-with-nested-modules/48752/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-255031" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="255031"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Of course, but it will raise compileError if your struct field names drift.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="255037" 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/how-do-you-work-with-nested-modules/48752/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-255037" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="255037"
                     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>